您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Apply Index

Apply Page # 1

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

basicline.gif (169 bytes)

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