Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ClassTest1
Language: JAVA
Code:
public class ClassTest1 {

    public static void main(String[] args) {

        int x = 15;

        int y = 20;

        gcd(x, y);

        System.out.println("GCD of 2 numbers" + gcd(x, y));

    }

   static int gcd(int x, int y) {

        if (x == 0) {

            return y;

        }

        if (y == 0) {

            return x;

        }

        return gcd(y, x % y);

    }

}
Comments: