Print ascii value, next character, pre character of entered character
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main()
{
char ch;
clrscr();
printf("enter the charter");
scanf("%c",&ch);
printf("charter=%c\n",ch);
printf("ascii value=%d\n",ch);
printf("next charter=%c\n",ch+1);
printf("pre charter=%c\n",ch-1);
getch();
}
/*
output :-
-----------
enter the charterg
charter=g
ascii value=103
next charter=h
pre charter=f
*/
#include<conio.h>
#include<ctype.h>
void main()
{
char ch;
clrscr();
printf("enter the charter");
scanf("%c",&ch);
printf("charter=%c\n",ch);
printf("ascii value=%d\n",ch);
printf("next charter=%c\n",ch+1);
printf("pre charter=%c\n",ch-1);
getch();
}
/*
output :-
-----------
enter the charterg
charter=g
ascii value=103
next charter=h
pre charter=f
*/
Thnxx.
ReplyDeleteit helped me in completing my assignment
And in prep. Of my mid-term exams :-)
DeleteThe question is to print ascii value for the input using command line argument.
ReplyDelete