To print a given string in upper case using C


Levels of difficulty: / perform operation:

C program to print a given string in upper case.

C Program

#include <stdio.h>
#include <conio.h>
void main()
{
	char s[100];
	int len,i;
	clrscr();
	printf("\nENTER A SENTENSE: ");
	gets(s);
	len=strlen(s);
	printf("\n");
	for(i=0;i<len;i++)
	{
		if(s[i]>=97 && s[i]<=122)
			printf("%c",s[i]-32);
		else
			printf("%c",s[i]);
	}
	getch();
}


Output







Quantitative Aptitude
Reasoning
Programming
Interview