ASCII-American standard code for information interchange.
ASCII table maintains a unique seven-bit number for each character using which the computer understands which key is pressed, following program will help to find the ASCII value for the entered character.
#include <stdio.h>
int main()
{
char c;
printf("Enter a character\n");
scanf("%c",&c);
printf("ASCII value of '%c' is %d\n",c,c);
return 0;
}
output:-
Enter a character
s
ASCII value of 's' is 115
program to find the character from its ASCII value
#include <stdio.h>
int main()
{
int a;
printf("Enter the ASCII value (in decimal)\n");
scanf("%d",&a);
printf("character for ASCII %d is %c\n",a,a);
return 0;
}
output:-
Enter the ASCII value (in decimal)
65
character for ASCII 65 is A
No comments:
Post a Comment
For any doubt or suggestion you can write here