C examples for Operator:Logic Operator
Use Boolean variables with logical operators.
#include <stdio.h> int main(void) { int age = 6;//from ww w . j a v a2s.com int grade = 10; bool over_12 = age > 12; bool under_20 = age < 20; bool age_check = over_12 && under_20; bool grade_check = grade > 5; if (age_check || grade_check) printf("a teenager, or in school."); return 0; }