1// Find GCD of two numbers in java using recursion
2public class GCDUsingRecursion
3{
4 public static void main(String[] args)
5 {
6 int number1 = 898, number2 = 90;
7 int gcd = gcdRecursion(number1, number2);
8 System.out.println("G.C.D of " + number1 + " and " + number2 + " is " + gcd);
9 }
10 public static int gcdRecursion(int num1, int num2)
11 {
12 if(num2 != 0)
13 {
14 return gcdRecursion(num2, num1 % num2);
15 }
16 else
17 {
18 return num1;
19 }
20 }
21}