Print ASCII of a Character – C Program

Print ASCII of a Character Using Integer Variable

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

//Program to Print ASCII of a Character - FScOnline.info

void main()
{
  int x;
  char ch;

  printf("Enter Character: ");
  scanf("%c", &ch);
  x=ch;
  printf("ASCII Value of %c: %d",ch,x);
  
  getch(); 
}

Print ASCII of a Character Without Using Integer Variable

#include <conio.h>

//Program to Print ASCII of a Character - FScOnline.info

void main()
{
  char ch;

  printf("Enter Character: ");
  scanf("%c", &ch);
  printf("ASCII Value of %c: %d",ch,ch);
  
  getch(); 
}

Output

c-program-to-print-ascii-of-a-character

Categories: C Language,C Programs,Computer Science

Tags: ,

Leave A Reply

Your email address will not be published.

×