C Program Write a Program for getche() to Receive user Selection
Turn Mobile View Off
by Dinesh Thakur

This program user ask to define the getch() function for receiving user selection about character that press on key board. User declares the variables that use to contain the value. In printing criteria user put a query about “do u want to continue (y/n)”. Here if user press ‘Y’ then the character pressed will be selection word as output else the condition will terminate.

Problem Statement:
This is C program user need to define the selection of user in getch() function.

  1. Declaring the variables.
  2. Using print method.
  3. Display result as output.

Here is C source code to define the selection of user in getch() function. The output of this program shown below.  

#include <conio.h>
#include <stdio.h>
int main(void) {
  char ch;
  printf("Do you wish to continue? (Y/N : )");
  ch = getche();
  if(ch=='Y') {
   /* continue with something */
  return 0;
 Program for getch() to Receive user Selection
Dinesh Thakur is a Technology Columinist and founder of Computer Notes and Technology Motivation. Turn Mobile View Off