Google Search

Saturday, October 24, 2015

C program for toggling of Characters of a string, like ComPuter-> output : cOMpUTER

‪#‎include‬<stdoi.h>
int main()
{
char name[100];
int loop;
printf("Enter any Sting: ");
fgets(name,sizeof(name),stdin);
for (loop=0; name[loop] !=0; loop++)
{
if(name[loop]>='A' && name[loop]<='Z')
name[loop]=name[loop]+32;
else if(name[loop]>='a' && name[loop]<='z')
name[loop]=name[loop]-32;
}
printf("\nConvert case of character : %s",name);
return 0;
}

No comments:

Post a Comment