#include <stdio.h>
#include <stdlib.h>
void main()
{
char x;
int n;
printf("\n enter a character");
scanf("%c",&x);
printf ("\n given character is %c", x);
printf ("\n ASCII code is %d\n " , x);
printf("\n enter a ASCII code");
scanf("%d",&n);
printf ("\n ASCII code is %d", n);
printf ("\n equivalent character is %c", n);
getch();
}
output:
enter a charactera
given character is a
ASCII code is 97
enter a ASCII code65
ASCII code is 65
equivalent character is A
#include <stdlib.h>
void main()
{
char x;
int n;
printf("\n enter a character");
scanf("%c",&x);
printf ("\n given character is %c", x);
printf ("\n ASCII code is %d\n " , x);
printf("\n enter a ASCII code");
scanf("%d",&n);
printf ("\n ASCII code is %d", n);
printf ("\n equivalent character is %c", n);
getch();
}
output:
enter a charactera
given character is a
ASCII code is 97
enter a ASCII code65
ASCII code is 65
equivalent character is A
No comments:
Post a Comment