C-Programming Tutorials

C Program to Find ASCII Value of a Character

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:

#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:

#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

C Program to Print Pascal Triangle (Prev Lesson)
(Next Lesson) C Program to Create Floyd’s Triangle
Back to C-Programming Tutorials

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!