C examples for Operator:Logic Operator
Use or condition to check both uppercase and lower case y
#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); }