Print next character in the ASCII sequence

How to write a c program to Read characters from the standard input/file and replace each character by the next character in the ASCII sequence in C Programming Language ?


https://en.wikipedia.org/wiki/Escape_sequences_in_C

Solution:
 /* Read characters from the standard input/file and replace each character by the next character in the ASCII sequence. E.g., replace 'a' by 'b', 'z' by 'a'. */


#include<stdio.h>
     
int main()
     
{
     

int b;
char a;


printf("Enter the character");  

scanf("%c",&a); // Machine reads the character


b=a; //b gets the ASCII value of the read character
//printf("the value of b is %d", b);


if(b>=97 && b<122)
{

b++; // ASCII value incremented

//printf("the next character's ASCII value is %d \n",b);    

printf("the character is %c \n", b);
}

else if(b==122)
{
printf("the character is a");

}
return(0);
}


Learn More :