not getting correct output: toggle string

#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
char a[10];

scanf("%s",a);
for(int i=0;i<10;i++) {
    if(isupper(a[i])) 
    {
        tolower(a[i]);
    //    printf("%s",a[i]);
        
    }
    else
    toupper(a[i]);
//    printf("%s",a[i]);
}
printf("%s",a);
return 0;

}

im not getting the correct output for this code, the character stays the same. it is not changing…
please help.

The function toupper(),tolower() take a character arguement which is converted to ASCII value and the functions return an integer value(ASCII again) which is implicitly(automatically) converted to alphabet.

Thus you could do: a[i]=tolower(a[i]);

Refer This you will get a proper Understanding

//