Write a program in Java to compute and display factorial of numbers up to a number entered via the Scanner class.
The output should look like as shown below when 7 is input.
IS: 10.961611917494269
OUTPUT
Enter a number: 7
11 (= 1) = 1
2! ( =1 2) = 2
3! ( = 1 x 2 x 3) = 6
4! ( = 1 X 2 X 3 X 4) = 24
5! ( = 1 x 2 x 3 x 4 x 5) = 120
6! ( = 1 x 2 x 3 x 4 x 5 x 6) = 720
7! ( =1 X 2 X 3 X 4 X 5 X 6 X 7) = 5040
Answers
Answered by
1
Answer:
11 (= 1) = 1
2! ( =1 2) = 2
3! ( = 1 x 2 x 3) = 6
4! ( = 1 X 2 X 3 X 4) = 24
5! ( = 1 x 2 x 3 x 4 x 5) = 120
6! ( = 1 x 2 x 3 x 4 x 5 x 6) = 720
7! ( =1 X 2 X 3 X 4 X 5 X 6 X 7) = 5040
Similar questions