Search Here

C program to change the case of a given alphabet



/* C program to change the case of an alphabet */

void main()
{
    char ch;

    printf("Enter an alphabet to change it's case: ");
    scanf("%c",&ch);
    if(ch>='a'&&ch<='z')
        printf("\nUpper case of %c is: %c",ch,ch-32);
    else if(ch>='A'&&ch<='Z')
        printf("\nLower case of %c is: %c",ch,ch+32);
    else
        printf("\nWrong input",ch);
}


Output

No comments:

Post a Comment