< previous page
page_128
next page >
Page 128
10. Name two things that contribute to the readability of a program.
11. Formatting a program incorrectly causes an error. (True or False?)
Programming Warm-Up Exercises
1. Write an assignment statement to calculate the sum of the numbers from 1 through
n
using Gauss's formula:
Store the result into the
int
variable
sum
.
2. Given the declarations
int i;
int j;
float x;
float y;
write a valid C++ expression for each of the following algebraic expressions.
3. Given the declarations
int i;
long n;
float x;
float y;
write a valid C++ expression for each of the following algebraic expressions. Use calls to library functions wherever they are useful.
< previous page
page_128
next page >