Compare int value in if statement
#include <stdio.h> int main() /*from w w w.j ava2 s . c o m*/ { int a,b; //Line 5 a = 6; b = a - 2; if( a > b) { printf("%d is greater than %d\n",a,b); } return(0); }
Line 5 declares two integer variables: a and b.
The variables are assigned values in Lines 7 and 8, with the value of variable b being calculated to be 2 less than variable a.
Line 10 makes a comparison:
if( a > b)