#include <stdio.h>
int main() {
int i;
char arr[100];
for (i = 0; i < 100; i++)
scanf("%c", &arr[i]);
for (i = 0; i < 100; i++) {
if ('a' <= arr[i] && arr[i] <= 'z')
arr[i] =-32;
else
if ('A' <= arr[i] && arr[i] <= 'Z')
arr[i] =+32;
}
printf("%s", arr);
return 0;
}
There was a problem:
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.
What is wrong with the above code? It is compiling successfully but there is a runtime error.