Sunday, 8 July 2012

c program check letter or digit (getchar(),isalpha(),isdigit())

For beginners
{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks, dev c++ Download dev c++ its free and install it in your computer.open  dev c++ go to file-->new-->source file.} 


#include<stdio.h>
#include<ctype.h>
#include<conio.h>
main()
{
      char c;
      printf("press any key\n");
      c=getchar();
      if(isalpha(c)>0)
      printf("the character is letter");
      else if(isdigit(c)>0)
      printf("the charcter is digit");
      else
      printf("the character is not alphanumarical");
      getch();
      }


For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}

IS IT HELPFIL? comment. 


No comments:

Post a Comment