8.03.2012

Print ASCII table

Q. Write a C program to print the ASCII table with numbers and corresponding characters.
or
Q. Write a C program to print the ASCII values 0 to 255 with numbers and related value.

Ans.

/*c program to print all ASCII table and its equivalent values with numbering*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int i;
 printf("ASCII table & its equivalent values with numbering: \n");
 for(i=1; i<=255; i++)
   printf("\nValue: %d -> ASCII character: %c",i,i);
 getch();
 return 0;
}

/************Output************/
/*Six snap shot for ASCII values: 0 to 255*/


Output of ASCII code value from 1 to 41
Screen shot for ASCII table 1 to 41


Output of ASCII code value from 42 to 86
Screen shot for ASCII table 42 to 86 

Output of ASCII code value from 87 to 131
Screen shot for ASCII table 87 to 131

Output of ASCII code value from 132 to 176
Screen shot for ASCII table 132 to 176

Output of ASCII code value from 177 to 221
Screen shot for ASCII table 177 to 221

Output of ASCII code value from 222 to 255
Screen shot for ASCII table 222 to 255

Related Program:

  1. Fill the screen with smile face icon. ( ASCII value of 'smile face' is '1' )

No comments:

Post a Comment