Task: Input a word and in function for every lovercase letter print capital letter and for every capital letter print lowercase letter. Example: input AuDi --> output aUdI
Can somebody help me solving my problem because this code isn't working.
#include <stdio.h>
#include<string.h>
void conv (char word);
int main(){
char wd[50];
printf("\n Input word:");
gets(wd);
conv(wd);
return 0;
}
void conv(char word){
int i,n=0;
n=strlen(word);
printf("\n New word: ");
for(i=0;i<n;i++){
if(word[i]>='a' && word[i]<='z'){
printf("%c",word[i]-32);
}else if(word[i]>='A'&& word[i]<='Z'){
printf("%c",word[i]+32);
}
}
printf("\n");
return;
}