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

*/

Comments

  1. Thnxx.
    it helped me in completing my assignment

    ReplyDelete
  2. The question is to print ascii value for the input using command line argument.

    ReplyDelete

Post a Comment