Write a C Program to accept a character from the keyboard and display its previous and next character in order. Ex. If character entered is ‘d’, display “The previous character is c”, “The next character is e”.
#include<stdio.h>
#include<conio.h>
void main()
{
char letter;
//accept character
printf("Enter the character: ");
scanf("%c",&letter);
printf("Previous character of %c is %c", letter, letter-1);
printf("\nNext character of %c is %c",letter, letter+1);
getch();
}
-
Next Write a program to accept a string and then count the occurrences of a specific character of a string.
-
Previous Create a structure Student (id, name, marks). Accept details of n students and write a menu driven program to perform the following operations. a) Search student by id b) Display all students
0 Comments