so im trying to write a program that gives me the factorial of a number, but i can't seem to get it to work i 've looked all over but it doesn't seem to help.
please help me figure out what i need to do to my code to make it print out the factorial of the number. right now i can make it print out basically a multiplication table of the number i enter, how can i add the numbers together to get the factorial? or what can i do with my code to make it work?
thank you for the help.
public static void main(String[] args){
int number = Console.readInt("Enter number ");
int count = 0;
int factorization = 0;
if (number<=1)
System.out.println ("Answer is 1");
else
count = number -1;
while (count>1)
{
factorization = number * count;
System.out.println(factorization);
count = count - 1;
}
}