find factorial of a number
807605Aug 19 2006 — edited Aug 6 2007I 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.