C Program to Find ASCII Value of a Character

cprogramming-Logo
C Programming Examples
C String Programs
C Loop Programs
C Function Programs
C Array Programs
C Integer Number Programs
C File I/O Programs

This C program is used to find and print the ASCII value of a letters, numbers, and other characters.

Each character or number has its own ASCII value.

Example:

The ASCII value of the number '5' is 53 and for the letter 'A' is 65.

Program:
/* 
* File: ascii.c
* Author: Gautam
* Created on August 17, 2017, 4:00 PM
*/ 

#include <stdio.h>

int main(){
char c = 'w';
printf("ASCII value of %c is %d\n", c, c);
return 0;
}
Program Output:
ASCII value of w is 119
Program:
/* 
* File: ascii.c
* Author: Gautam
* Created on August 17, 2017, 4:00 PM
*/ 

#include <stdio.h>

int main(){
char c;
printf("Please enter a character: ");
scanf("%c", &c); 
printf("ASCII value of %c is %d\n", c, c);
return 0;
}
Program Output:
Please enter a character: g
ASCII value of G is 103

Scroll Back to Top