/*This is a 'C' program.
This program will check the upper or lower case of given alphabet.
And it also convert the given alphabet into one to another case.*/
#include<stdio.h>
#include<conio.h> //header files
void main()
{
char ch;//variable
clrscr();
printf("Enter a alphabet : ");
scanf("%c",&ch);
if((ch<65||ch>122)||(ch>90&&ch<97))//this statement will check that the given character is a alphabet or not.
printf("\n Invalid alphabet!!!");
else if (ch>=65&&ch<=90)//this statement will check that the given alphabet is in upper case or not.
{
printf("\n The given alphabet is in upper case...");
ch=ch+32;//this statement is use to convert the given alphabet into lower case.
printf("\n\n And the lower case of given alphabet is: %c",ch);
}
else//this statement will conclude that the given alphabet is in lower case.
{
printf("\n The given alphabet is in lower case...");
ch=ch-32;//this statement is use to convert the given alphabet into upper case.
printf("\n\n And the upper case of given alphabet is: %c",ch);
}
getch();
}//end of program
No comments:
Post a Comment