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

Share.

I'm a full-stack developer, specializing in the PHP, JS, Wordpress, MEAN Stack, MERN Stack & Django. I hold a high standard of quality in everything that I do.

Leave A Reply