C Program to Find ASCII Value of a Character – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Fri, 26 Aug 2022 10:31:13 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg C Program to Find ASCII Value of a Character – Programmerbay https://programmerbay.com 32 32 C Program to Find ASCII Value of a Character https://programmerbay.com/c-program-to-print-the-integer-equivalent-of-uppercase-letters-lowercase-letters/ https://programmerbay.com/c-program-to-print-the-integer-equivalent-of-uppercase-letters-lowercase-letters/#respond Thu, 25 Aug 2022 06:56:53 +0000 https://programmerbay.com/?p=5354 The program accepts a character as an input and prints its corresponding ASCII value on output screen.

The ASCII values are ranging from 0 to 128 that cover numbers from 0 to 9, uppercase letters and lowercase letters from a to z and some special characters are also the part of this system.

For example, ASCII value of 0 is 48.

C program to find ASCII value of character

or

Write a program which prints the integer equivalent of uppercase letters, lowercase letters, digits and some special symbols.

Program:

#include <stdio.h>
int main()
{
char value;
printf("Enter a Value = ");
scanf("%c", &value);
printf("integer value of %c = %d\n", value, value);
return 0;
}

Output:

In case of number

Enter a Value = 0
ASCII integer value of 0 = 48

In case of uppercase letter

Enter a Value = A
ASCII integer value of A = 65

In case of lowercase letter

Enter a Value = a
ASCII integer value of a = 97

In case of special character

Enter a Value = @
ASCII integer value of @ = 64

Explanation:

  1. Getting letter as an input from the user
  2. printing its corresponding ASCII and character values on output screen
  3. %d format specifier represents integer for printing ASCII value and %c represents character for printing the input character.

]]>
https://programmerbay.com/c-program-to-print-the-integer-equivalent-of-uppercase-letters-lowercase-letters/feed/ 0