Pages

How to enter character

//How to enter character.


#include<stdio.h>
#include<conio.h>

void main()
{
  char c; //Decalre a character variable
  clrscr(); //Clear the previous output screen
  printf("Enter the letter: "); //Show the message to user for enter the character value
  scanf("%c",&c); //Save the value in c variable
  printf("You entered: %c",c); //Show the output(message and value)
  getch();
}

Output:

Enter the letter: s
You entered: s

No comments:

Post a Comment