Tuesday, 9 December 2014

C Program to print integer equivalent of character

Program to print integer equivalent of character
#include<stdio.h>
main()
{
int n;
printf("enter any integer\n");
scanf("%d",&n);
printf("n=%d n=%c\n",n,n);
}
OutPut:
enter any integer
123
n=123 n={
madan@madan-Lenovo-G570:~/madan$ ./a.out
enter any integer
45
n=45 n=-
madan@madan-Lenovo-G570:~/madan$ ./a.out
enter any integer
56
n=56 n=8
madan@madan-Lenovo-G570:~/madan$ ./a.out
enter any integer
98
n=98 n=b