Write a program in Java to find GCD of n numbers i.e an Array.


Greatest Common Divisor (GCD) of two or more positive numbers is the largest of them which divides all of them.

To calculate the GCD of multiple numbers all we need to first calculate the GCD of the first two numbers and then it’s resultant GCD with the third and again the previous GCD result with the forth and so on.

To implement the same we will have to loop through the array. So let’s do it.


If you have any suggestion or doubts then comment below.

Leave a Reply

Close Menu