7. Accept a character from the keyboard and display its previous and next character in order.
Ex. If the character entered is ‘d’, display “The previous character is c”, “The next character is e”.#include<stdio.h>
#include<conio.h>
void main()
{
char m;
clrscr();
printf("\nFinding the first and last charcher of enter character on basis on ABC..");
printf("\nEnter the characher:");
scanf("%c",&m);
printf("\nFirst character is:%c",m+1);
printf("\nLast character is:%c",m-1);
getch();
}
/*
Finding the first and last charcher of enter character on basis on ABC..
Enter the characher:T
First character is:U
Last character is:S
*/
No comments:
Post a Comment