A program to read the graphical character and print their equivalent ASCII code and vice versa
Here is the C source code to read the graphical characters given by user and print their equivalent ASCII code using simple input output operation.
/*A program to read the graphical character and print their equivalent ASCII code*/
#include <stdio.h>
#include <conio.h>
void main()
{
char a; //variable declaration
printf(“enter the graphical character to print ASCII code: “);
scanf(“%c”,&a);
printf(“The ascii value of %c=%d\n”,a,a);
getch();
}
Now here is just the reverse of above program. This program will read the ascii value given by user and then it will print equivalent characters.
/* A program to read the ascii value and print the equivalent characters.
programmed by
name: Jitendra
date: 30 December 2010 */
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
printf(“Enter the ASCII value:”);
scanf(“%d”,&a);
printf(“The equivalent character of %d=%c”,a,a);
getch();
}
Writing comments in C source code is a significant of a good programmer. So write the comments where needed so that another programmer can understand what you used for what.
Comments (1)