reverse factorial program in java

Solutions on MaxInterview for reverse factorial program in java by the best coders in the world

showing results for - "reverse factorial program in java"
Beatrice
23 Oct 2020
1// Reverse factorial program in java
2import java.util.Scanner;
3public class ReverseFactorialProgram
4{
5   public static void main(String[] args)
6   {
7      Scanner sc = new Scanner(System.in);
8      System.out.println("Please enter a number to compute reverse factorial: ");
9      int number = sc.nextInt();
10      int reverse = number;
11      for(int a = 2; reverse != a; a++)
12      {
13         reverse = reverse / a;
14      }
15      System.out.println("Reverse factorial of " + number + " is: " + reverse);
16      sc.close();
17   }
18}