Thursday 25 July 2013

Chapter 2 solutions Problem [F][b]

Question-Any character is entered through the keyboard, write a
program to determine whether the character entered is a
capital letter, a small case letter, a digit or a special symbol.
Solution-
good problem for get more familiar with char. Here is the solution

#include<stdio.h>
int main()
{
char i;
printf("Enter Any character\n");
scanf("%c",&i);
if(i>=65&&i<=90)
printf("Upper Case Letter\n");
else if(i>=97&&i<=122)
printf("Lower Case Letter\n");
else if((i>=0&&i<=47)||(i>57&&i<65)||(i>90&&i<97)||(i>=123&&i<=127))
printf("A special symbol\n");
else
printf("It's a number\n");
return 0;
}

No comments:

Post a Comment