Social Icons

Friday, 14 February 2014

Program to read a string and generate a list of ASCII codes of each character

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

void main()
{
int i;
char name[50];
clrscr();
printf("\n Enter a string : ");
gets(name);
printf("\n Character\t ASCII Code");
printf("\n----------- \t------------");

for(i=0;name[i]!='\0';i++)
printf("\n   %c\t\t   %d",name[i],name[i]);

getch();
}


                                               Output

No comments:

Post a Comment