Change Case of The Letter - C Program

Program:
#include<stdio.h>
//#include<conio.h>
void main()
{
    char c; //clrscr();
    printf("\n\t***A PROGRAM TO CHANGE THE CASE OF THE CHARACTER***\n\n");
    printf("Enter a character:");
    scanf("%c",&c);
    if(c<96)
    {
        printf("\nYou entered the upper case letter '%c' \n\tThe lower case is '%c'.\n",c,c+32);
    }
    else
    {
        printf("\nYou entered the lower case letter'%c' \n\tThe upper case is'%c'.\n",c,c-32);
    }
    //getch();
}

Output:
nn@linuxmint ~ $ gcc CC3.c
nn@linuxmint ~ $ ./a.out

    ***A PROGRAM TO CHANGE THE CASE OF THE CHARACTER***

Enter a character:a

You entered the lower case letter'a'
    The upper case is'A'.
nn@linuxmint ~ $

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...