Program to convert a Character into ASCII value using C Language

In C language, The integer value for a character is always it’s ASCII value. So If you want to print an ASCII value of a character in C then simply use %d to get the character’s ASCII integer value.

Code:
#include<stdio.h>
 void main(){
 int c;
 char d;
 printf("\n\n*****************Program to output ASCII code for an input********************\n");
 printf("Enter Any value to Show their ASCII Code: \n");
 scanf("%c",&d);
 printf("ASCII value for %c is %d\n",d,d);
 }

OUTPUT:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: