You are almost there. You are missing some code in your main
:
- Prompt the user to enter a number. You can use
System.out.println
for that. - Read an
int
the user enters. You can useScanner.nextInt
for that. - Set up a
for
loop with variablei
that goes from0
to the number entered by the user. - Call
System.out.println(i + "! = " + factorial(i))
in the body of the loop.
Once you finish the four steps above, you are done!