Program to find ASCII value of a character in C

Source Code

// 5. Program to find ASCII value of a character
// Arpan Das - CST 2nd Year (VOCLET)

#include <stdio.h>
//#include <conio.h>
#include <stdlib.h>

void main () {
	char ch;
	//clrscr();
	//system("cls");
	
	printf("\t\t..:: find ASCII value of a character ::..\n\n");
	printf("Press any key to get it's equivalent ASCII value...");
	//ch = getch();
	scanf("%c", &ch);
	
	printf("\n\nThe ASCII value for %c is %d", ch, ch);
	
	//getch();
}

Output

		..:: find ASCII value of a character ::..

Press any key to get it's equivalent ASCII value...A

The ASCII value for A is 6

Leave a Reply

Note: Your email address will not be published. Required fields are marked *