Monday, January 24, 2011

Managing Input and Output Operations

A program that reads a character from keyboard and then prints it in reverse case. That is, if the
input is upper case, the output will be lower case and vice versa.
#include<stdio.h>
void main()
{
char alphabet;

printf("Enter an alphabet");
putchar('\n'); /* move to next line */
alphabet = getchar();
if (islower(alphabet))
putchar(toupper(alphabet));
else
putchar(tolower(alphabet));
getch();
}

No comments:

Post a Comment