C Programming

Practise Exercise 3: printf() and scanf()

JavaScript compatible inter-active version of this test.

1. Use a printf statement to print out the value of the integer variable sum

2. Use a printf statement to print out the text string "Welcome", followed by a newline.

3. Use a printf statement to print out the character variable letter

4. Use a printf statement to print out the float variable discount

5. Use a printf statement to print out the float variable dump using two decimal places

6. Use a scanf statement to read a decimal value from the keyboard, into the integer variable sum

7. Use a scanf statement to read a float variable into the variable discount_rate

8. Use a scanf statement to read a single character from the keyboard into the variable operator. Skip leading blanks, tabs and newline characters.

Answers


©Copyright B Brown. 1984-1999. All rights reserved.