Replace lowercase letters by uppercase and vice versa without using library function

Given a string, replace all the lowercase letters of the string to uppercase letters and all the uppercase letters of the string to lowercase letters.



#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void) {
   char *s;
   int len;
   s=(char*)malloc(sizeof(char));
   scanf("%s",s);
   len=strlen(s);
   while(*s)
   {
   if(*s>=65 && *s<=90)
     {
      *s=*s+32;
     }
     else if(*s>=97 && *s<=122)
     {
      *s=*s-32;
     }
    s++;
   }
   s=s-len;
   printf("%s",s);
   return 0;
}