Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static int factorial(int start, int end) {
        if (start < 0) {
            throw new IllegalArgumentException("x must be>=0");
        }
        if (start == end) {
            return end;
        } else if (start > end)
            return start * factorial(start - 1, end);
        else
            throw new IllegalArgumentException("start must be >= end");

    }
}