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

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Apply Index

Apply Page # 5

Activity 5 – Factorials

Write a Java applet that works out the factorial of 50.

A factorial is an important concept in some branches of mathematics; the factorial of a particular number is calculated by multiplying all the whole numbers up to and including the number itself.

For example, the factorial of 10 is calculated as 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1.

In your applet, however, you should use a loop to calculate the factorial.

You should be able to get the answer in about 8 lines of Java

Discussion/Suggested solution to Activity 5

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