Week1 Review
Week1 Review
1. Show the output displayed by the following program lines when the data entered are 5 and 7:
Show the contents of memory before and after the execution of the snippet above.
2. Show the output displayed by the following lines if the value of exp is 11 :
3. How could you modify the code in problem 2 above so that “My name is Jane Doe.” and “I live in
Ann Arbor, MI” would appear on the same line without running together (i.e., with a space
between the period and the “I”)?
4. Write the #define preprocessor directive and declarations for a program that has a constant
macro for PI (3.14159) and variables radius, area, and circumf declared as double , variable
num_circ as an int , and variable circ_name as a char .
5. Write a program that stores the values 'X' and 76.1 in separate memory cells. Your program
should get the values as data items and display them again for the user when done.
6. Write a program that asks the user to enter the radius of a circle and then computes and
displays the circle’s area. Use the formula
Area = PI * Radius * Radius
where, PI is the constant macro 3.14159.
7. Convert the following mathematical formulae into C-syntax: