C program to print ASCII value of a character

C program to print ASCII value of a character

#include<stdio.h>
#include<conio.h>

void main()
{
int a;
char ch;

clrscr(); //to clear the screen
printf(“Enter any character:”);
scanf(“%c”,&ch);
a=ch;
printf(“ASCII value of %c is %d”,ch,a);
getch(); //to stop the screen
}

2 thoughts on “C program to print ASCII value of a character

    1. Md Mamun

      #include
      int main()
      {
      char c;
      printf(“Enter a character: “);
      scanf(“%ch”,&c);
      printf(“ASCII value of %c=%d”,c,c);
      return 0;

      }

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *