prev


ASCII value

36. Classifies upper,lower,Digit or special character (16.7.2009)

/*
Program# 36
date : 25-12-2008
Biggest of three numbers
*/

#include <stdio.h>
main(){
char a;
printf("\nEnter a character :");
scanf("%c",&a);
if(a>=65 && a<=90)
printf("\n%c is uppercase letter\n",a);
else
if(a>=97 && a<=122)
printf("\n%c is Lowercase letter\n",a);
else
if(a>=48 && a<=57)
printf("\n%c is a Digit\n",a);
else
printf("\n%c is Special character\n",a);
}

output:
To compile the program, run the gcc command,
$ gcc p36.c
Now the executable file is stored as a.out, to run
the program,
$ ./a.out
Enter a character :r
r is Lowercase letter
$ ./a.out
Enter a character :M
M is uppercase letter
$ ./a.out
Enter a character :^
^ is Special character
$ ./a.out
Enter a character :9
9 is a Digit
$

next
blog comments powered by Disqus