Lokesh have been given a String S consisting of uppercase and lowercase English alphabets. Lokesh need to change the case of each alphabet in this String. That is, all the uppercase letters should be converted to lowercase and all the lowercase letters should be converted to uppercase.
#include <stdio.h>
#include<string.h>
int main()
{char ch[100];
int length,i;
scanf("%s",ch);
length=strlen(ch);
for(i=0;i<length;i++)
{
if(ch[i]>=65&&ch[i]<=90)
ch[i]=ch[i]+32;
else if(ch[i]>=97)
ch[i]=ch[i]-32;
}
printf("%s",ch);
return 0;
}
Comments
Post a Comment