Hi everyone I am new to the community and been programming in java for 2 weeks. This is my 3rd program so please take it easy on me, I know there are better ways to do things but this is what I know for now. The purpose of the program is to get the factorial of a number. It compiles but I never get an answer. The program is doing something because the fan on the processor starts running so the processor is doing a lot of work. Here is what I have written. I am using 2 while statements and not sure I am doing them right. Thanks for any help you can give.
//program to get factorial of a number
import java.util.Scanner;
public class Factorial
{
//calculate factorial of a number
public static void main( String[] args)
{
Scanner input=new Scanner(System.in);
int number;//the input number
int mutiplier;//the mutiplier
double answer1;//the answer
double finial;//the factorial
//get the number to be the factorial
System.out.print("enter any number to get it's factorial (-1 to quit):");
number=input.nextInt();
finial=0;
while (number !=-1);
{
mutiplier = number;
while (mutiplier !=0);
{
answer1= number*mutiplier;
mutiplier=mutiplier-1;
finial += answer1;
}
System.out.printf("factorial is:%d\n",finial);
}
}
}