C Programming

MAKING DECISIONS

Practise Exercise 5: while loops and if else

JavaScript compatible inter-active version of this test.

1. Use a while loop to print the integer values 1 to 10 on the screen

	12345678910

2. Use a nested while loop to reproduce the following output

	1
	22
	333
	4444
	55555

3. Use an if statement to compare the value of an integer called sum against the value 65, and if it is less, print the text string "Sorry, try again".

4. If total is equal to the variable good_guess, print the value of total, else print the value of good_guess.

Answers


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