Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

find factorial of a number

807605Aug 19 2006 — edited Aug 6 2007
I have a question to find the factorial of a number and wrote a program but it did not work and I know why but do not know how to solve it.

I wrote

import uk.ac.warwick.dcs.util.io.IO;

public class problemsheet
{
public static void main(String[] args)
{
int i;
int number;
number = IO.readint("Enter a number");

for (i = number; i>1; i--){
number * (number - 1);

}
System.out.println("The factorial is " + number);


}
}

The IO readint is part of the class at my uni and it is just to input a number.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2007
Added on Aug 19 2006
6 comments
328 views