Print ASCII of a Character – C Program

0

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

You might also like

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More