81
Chapter 8: C Programming
Example: In the following prog ram, if x is g reater than 30, the words “X is big” will print. If
x is not greater than 30, the words “X is small” will print. In either case, “All done” will always
print.
int x;
main()
{
x=23;
if (x>30)
{
puts(“X is big\n”);
}
else
{
puts(“X is small\n”);
}
puts(“All done\n”);
}
There are C commands other than “if” and “else”, and built in variables to access ISACC’s
inputs and outputs. Details for these will be covered later.