import java.util.*;
public class factorial
{
public static void main(String[]args)
{
int m,f,n;
System.out.println("Factorial Solver");
System.out.println("Enter a number");
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = 1;
f = 1;
f = f * m;
while (m != n)
{
m = m + 1;
}
f = f * m;
System.out.println(f);
}
}
Whenever I run it, it does not come out with the factorial. It just prints out the inputted value most of the time. Why is that?