OneCompiler

Write a c program that accept two character (alphabet) from user, and print message that “Both character are same “ if both alphabet are same and in opposite case otherwise convert the 2nd alphabet as the opposite case of the 1st alphabet.

Write a program that accept two character (alphabet) from user, and print message that “Both character are same “ if both alphabet are same and in opposite case otherwise convert the 2nd alphabet as the opposite case of the 1st alphabet.

1 Answer

4 years ago by
#include <stdio.h>
int main()
{
    char c1,c2;
    scanf("%c %c", &c1,&c2);
    if(c1==c2){
    printf("Both character are same\n");
    }
    else{
    c2 = c1;
    printf("%c %c",c1,c2);
}
} 
4 years ago by Aton