Solution for Exercise 8-1
ex0801
#include <stdio.h>
int main()
{
int a,b;
a = 6;
b = a - 2;
if( a > b)
{
printf("%d is greater than %d\n",a,b);
}
return(0);
}
Output
6 is greater than 4
Notes
* Comparisons, or evaluations, are made in code when you can't really predict what the outcome will be. In this example, it's pretty easy to figure out what the result will be. In a more realistic example, the comparison of a and b would be based on input or other conditions unknown at runtime.
Copyright © 1997-2025 by QPBC.
All rights reserved
