Program that provides the use of getchar function.
#include <stdio.h> main() { char answer; printf("Would you like to know my name?\n"); printf("Type Y for YES and N for NO: "); answer = getchar(); /* .... Reading a character...*/if(answer == 'Y' || answer == 'y') printf("\n\nMy name is BUSY BEE\n"); else printf("\n\nYou are good for nothing\n"); } Output Would you like to know my name? Type Y for YES and N for NO: Y My name is BUSY BEE Would you like to know my name? Type Y for YES and N for NO: n You are good for nothing