Use if statement to check user answer to the old yes-or-no question, case sensitive. - C Statement

C examples for Statement:if

Description

Use if statement to check user answer to the old yes-or-no question, case sensitive.

Demo Code

#include <stdio.h>
int main()/*from   w ww .  j a  v a2  s  .c o  m*/
{
   char c;
   printf("Would you like? Input y for yes and n for no");
   c=getchar();
   if(c=='N')
   {
      printf("Okay. \n");
   }
   else{
      printf("Bye!\n");
   }
   return(0);
}

Result


Related Tutorials