Solution for Exercise 8-3
ex0803
#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
* It's customary to indent the sole statement belonging to if, but it's not required. Sometimes, especially when the statement is short, they're both combined on the same line:
* For readability sake, and until you have a lot of coding under your belt, I recommend keeping if and a sole statement belonging to it on two lines. Further, I recommend using the curly braces to block a single statement until you're comfortable knowing when they're required and when they're optional.
Copyright © 1997-2025 by QPBC.
All rights reserved
