Read a number from the keyboard, and show its ASCII Equivalent symbol | Number to ASCII program in C


Program Introduction:

Write a C Program to Convert a Number to ASCII Symbol. The Program should take input a number from the user and then display the ASCII equivalent of it.

Here are couple of expected inputs and outputs.

Example 1:



The ASCII equivalent of 65 is Upper case ‘A’.

Example 2:



Example 3:



Example 4:



Number to ASCII Conversion Program logic:

We are going to take Numbers from 0 to 255 only. If user enters any other number, Then display the error message.

But only 127 ASCII characters are printable characters. To be exact the printable ASCII Characters from number 32 which is space to number 126 which is ESC. So our output might give undefined values after 127 Number.

The basic idea is to pass the integer value to  printf function and use the character format specifier ( %c). So the printf function will cast the integer to ASCII character. and prints the ASCII Symbol output to the console.

📢 ASCII symbols for the numbers between 128 to 255 are non-printable, So we might get undefined output for numbers after 127.

Program: Number to ASCII Conversion:

Number to ASCII Program Output:

We are using the GCC compiler in Linux OS to compiler the program.

Related Programs:

Learn more about ASCII :


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

1 Response

  1. […] Now, To Toggle to the case of all characters, We will go through the all characters of the string using a For Loop, and based on the case of the string we either Add or Subtract the 32 from the character ASCII Value. […]

Leave a Reply