Use or condition to check both uppercase and lower case y - C Operator

C examples for Operator:Logic Operator

Description

Use or condition to check both uppercase and lower case y

Demo Code

#include <stdio.h>
int main()/*  ww w  . j a  v a2s . c  o m*/
{
   char c;
   printf("Would you like? y or n");
   c=getchar();
   if(c=='Y' || c=='y')
   {
      printf("OK: \n");
      printf("Bye!\n");
   }
   else {
      printf("N!\n");
   }
   return(0);
}

Result


Related Tutorials