Algorithm Sample - Factorial - Reverse Engineering


package algorithmsample31;

import java.util.Scanner;

/**
 *
 * @author Nurhak
 */
public class AlgorithmSample31 {

    public static void main(String[] args) {
        String data = "";
        int number = 0;
        int factorial = 0;

        try {
            Scanner scan = new Scanner(System.in);
            System.out.println("Enter the factorial fuction result please:");
            data = scan.nextLine();
            factorial = Integer.parseInt(data);
            number = factorial;
            for (int i = 1; i <= (factorial - 1); i++) {
                factorial = factorial / i;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(number + " equals to " + factorial + " !");
    }
}

Comments

Popular posts from this blog

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Solution for "Can not obtain Oracle client information from registry"