Ascii Name in C

Ascii Name

QUESTION DESCRIPTION


Write a program which reads your name from the keyboard and outputs a list of ASCII codes, which represent your name

TEST CASE 1

INPUT

SRMUNIVERSITY

OUTPUT

The ASCII values of the string are:
83 82 77 85 78 86 69 82 83 73 84 89


#include <stdio.h>

int main(){
 char input_str[1000];

 scanf("%s",input_str); // taking input

 printf("The ASCII values of the string are:\n"); // print mandatory line

 for(int i=0;input_str[i]!='\0';i++){ 
  printf("%d ",(int)(input_str[i])); // convert and print in the same line
 }
 return 0;
}

Comments

Popular Posts