This program checks each character one by one. If
the character is in lowercase, then it is converted into uppercase. But if it
is in uppercase then converts into lowercase. The source code is successfully
compiled and run on any operating system.
#include <stdio.h>
#include <ctype.h>
int main()
{
char sentence[100];
int count, ch, i;
printf("Enter One or Multiple
Sentence:\n\n\t");
for (i = 0; (sentence[i] = getchar()) != '\n'; i++)
{
;
}
count = i;
printf("\n\nConverting Lowercase to Uppercase or
Vice Versa:\n\n\t");
for (i = 0; i < count; i++)
{
ch = islower(sentence[i])?
toupper(sentence[i]):tolower(sentence[i]);
putchar(ch);
}
printf("\n");
}