< 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:
0128-01.gif
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Store the result into the int variable sum.
2. Given the declarations
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
int   i;
int   j;
float x;
float y;
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
write a valid C++ expression for each of the following algebraic expressions.
0128-02.gif
3. Given the declarations
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
int   i;
long  n;
float x;
float y;
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
write a valid C++ expression for each of the following algebraic expressions. Use calls to library functions wherever they are useful.
0128-03.gif

 
< previous page page_128 next page >