You have been given a String consisting of uppercase and lowercase English alphabets. You 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. You need to then print the resultant String to output.
ex. Input string is:
abcdeF
output string is:
ABCDEf
Program:
#include <stdio.h>
|
int main()
|
{
|
int i;
|
char s[100];
|
scanf("%s",&s);
|
for(i=0;s[i]!='\0';i++)
|
{
|
if(s[i]<=95&&s[i]>=65)
|
s[i]=s[i]+32;
|
else
if(s[i]>=97&&s[i]<=123)
|
s[i]=s[i]-32;
|
}
|
printf("%s\n",s);
|
return 0;
|
}
|
Output:
abcdeF
ABCDEf
Please comment and give Suggestion on this post, if you want any other program or help then type in comment or contact me, and give feedback for this blogs.
No comments:
Post a Comment