Advertisement

LOWER OR UPPERCASE

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int c=0;
char ch, s[10];
printf("input a string\n");
gets(s);
while(s[c] !='\0')
{
ch=s[c];
//use this line for not typing again s[c] to save time
if(ch>='A'&&ch<='Z')
s[c]=s[c]+32;
else if(ch>='a'&&ch<='z')
s[c]=s[c]-32;
c=c+1;
{
printf("%s\n",s);
}
}
getch();
}
                                            input aA
                                           output Aa

Post a Comment

0 Comments