C examples for Statement:if
Determine if a number is even or odd with if...else statement
#include <stdio.h> int main (void) { int number_to_test, remainder; printf ("Enter your number to be tested: "); scanf ("%i", &number_to_test); remainder = number_to_test % 2;/*from ww w . ja v a 2 s.c om*/ if (remainder == 0) printf ("The number is even.\n"); else printf ("The number is odd.\n"); return 0; }