summaryrefslogtreecommitdiff
path: root/java/Recursion.java
blob: 88f4f0e759efaa110340b20e6b986b67c516dbce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class Recursion {
    public static void main(String[] args) {
        int x = 169;
        int y = 2;

        System.out.println(recurse(x, y));

    }
    public static int recurse(int x, int y) {
        if (x < y) {
            return x;
        } else {
            return recurse(x - y, y);
        }
    }
}