C Program to Find ASCII Value of Character

Write C Program to find ASCII value of given character

#include <stdio.h>

int main()
{  
    char c;
    printf("Enter a character :--> ");
    scanf("%c", &c);  
  
    printf("ASCII value of %c = %d", c, c);
    
    return 0;
}

Output:

Run - 1:
Enter a character :--> g
ASCII value of g = 103

Run - 2:
Enter a character :--> G
ASCII value of G = 71

<< Previous | Next >>


Leave a Reply

Your email address will not be published.