C Program to Find ASCII Value of a Character

Source Code


/* Source code to find ASCII value of a character entered by user */

#include <stdio.h>
int main(){
    char c;
    printf("Enter a character: ");
    scanf("%c",&c);        /* Takes a character from user */
    printf("ASCII value of %c = %d",c,c);
    return 0;
}
Output
Enter a character: G
ASCII value of G = 71

No comments

Powered by Blogger.