#include<stdio.h>
#include<conio.h>
int main()
{
int i;
char c;
clrscr();
printf("\nenter
an integer");
scanf("%d",
&i); // Input-65
printf("\nenter
a character");
fflush(stdin);
// Clears
input buffer there may be space or new line char in input buffer
scanf("%c",
&c);// Input-A
printf("\n%d",
c);//Answer=65
//prints
ASCII code of character stored in variable c
printf("\n%c",
i); Answer=A
//prints
character corresponding to the value store in i
i=i+1;
c=c+1;
printf("\n%d",
i);// Answer=66
printf("\n%c",
c);// Answer=B
getch();
return 0;
}
No comments:
Post a Comment