PLAY WITH CODING

Home Basic Program If & Else Loops Conversion Pattern logo

Basic C Program

Program to find a character with respect to ASCII value

Input - Output

Input
Enter an integer as ASCII value : 66

Output
Character w.r.t to ASCII value = B

Algorithm

Step 1: START

Step 2: Enter an integer as input.

Step 3: Print character w.r.t ASCII value

Step 5: END

CODE


/*Character with respect to ASCII value*/

#include  <stdio.h>
int main()
{
      int ascii_value;
      printf("Enter the a ascii_value of any character : ");
      scanf("%d",&ascii_value);
      printf("Character w.r.t ascii value %d = %c",ascii_value,ascii_value);
    return 0;
}


/*Character with respect to ASCII value*/

#include  <iostream>
using namespace std;
int main()
{
      int ascii_value;
      cout<<"Enter the a ascii_value of any character : ";
      cin>>ascii_value;
      cout<<"Character w.r.t ASCII value "<<ascii_value<<" = "<<char(ascii_value);
    return 0;
}

OutPut

Enter an integer as ASCII value : 66

Character w.r.t to ASCII value = B