C Program to Convert Lowercase Character to Uppercase Character

Program


#include<stdio.h>
#include<conio.h>

int main()
{
	 char c;
	 clrscr();
	 printf("Enter any character: ");
	 scanf("%c", &c);
	
	 if(c>='a'&&c<='z')
	 {
		  c = c-32;
		  printf("Uppercase is: %c", c);
	 }
	 else
	 {
	  	printf("It is not lowercase character.");
	 }
	
	 getch();
	 return(0);
}

Output of above program :

Run 1:
-------------
Enter any character: g ↲
Uppercase is: G

Run 2:
-------------
Enter any character: G ↲
It is not lowercase character.

Run 3:
-------------
Enter any character: * ↲
It is not lowercase character.

Note: ↲ indicates ENTER is pressed.