Activity
1 – Totalling using a 'while' loop
(1) Write an applet that displays the total of
adding 1 + 2 + 3 + 4 + 5.

Use a while loop to implement your
loop.
When run your program should display its
applet window on screen as follows:
(2) Amend your program so that it displays the
total of adding up 1 + 2 + 3 … + 20
Discussion/Suggested solution to Activity 1
Back to content
Back
to top

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg |