The problem is : Write a C program to covert lowercase letters to uppercase letters and vice versa of string S. 1<=S<=100
EXAMPLE:
INPUT
HelloWORLD
Expected OUTPUT
hELLOworld
INPUT
RanDoM
Expected OUTPUT
rANdOm
My code
#include<stdio.h>
#include<string.h>
int main()
{ char s[100];
int i;
for (int j=0; j<=100 ; j++)
{
 scanf("%s",&s[j]) ;
}
for (i=0; s[i]!='\0'; i++)
    {
        if (s[i]>='a' && s[i]<='z')
        {
            s[i] = s[i] - 32;
        }
        else
        {
            s[i] = s[i] +32;
        }
    }
    for (int k=0; k<=100 ; k++)
    {    
        if (s[k]!='\0')
      {  printf("%c",s[k]) ; }
    }
    return 0;
}
The OUTPUT which I am getting is:
INPUT
HelloWORLD
Current OUTPUT
hELLOworldԯ@ _�"����ԯ8_�"�>sn�"�
INPUT
 RanDoM
Current OUTPUT
rANdOm�
�$@0�������$H����>s�
What changes in the code do I need to make so that I can get rid of the symbols at the end of the word?
After all the suggestions and help I have found the code which gives the expected output:
#include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    int main()
    {  char str[100];
 scanf("%s",str);
       int i;
    for (i=0; i<sizeof(str); i++)
        {    
            if (str[i]>='a' && str[i]<='z'&& str[i]!='\0')
            {
                str[i] = str[i] - 32;
            }
            else if(str[i]>='A' && str[i]<='Z'&& str[i]!='\0')
            {
                str[i] = str[i] +32;
            }
        } 
         printf("%s",str);
        return 0;
    }
 
    