Sunday, April 26, 2015

Display the characters and ascii values from 0 to 255




#include< stdio.h >
void main()
{
 int i=0;
 clrscr();
  while(i<=255)
 {
 printf("\nAscii value of %c = %d",i,i);
 i++;
 }
  getch();
   }

 The above program will display the characters with ascii values starting from 0 to 255.The problem is that all the displayed lines will  not be visible as the screen can't accommodates all the 256 lines.



   #include< stdio.h>
void main()
{
 int i=0;
 clrscr();
  while(i<=255)
 {
 printf("\nAscii value of %c = %d",i,i);
 if((i+1)%20==0)
 {
 printf("\nPress any key to continue.....");
 getch();
 clrscr();
 }
 i++;
 }
  getch();
   }

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner