Skip to content

Commit 3bd769d

Browse files
authored
Increase recursive GCD
1 parent 962720f commit 3bd769d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Others/GCD.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ public static int gcd(int a, int b) {
1313
return b;
1414
}
1515
}
16+
17+
//Increase the number of calculations.
18+
//Use functoin from above as recursive.
19+
public static int gcd(int[] number) {
20+
int result = number[0];
21+
for(int i = 1; i < number.length; i++)
22+
result = gcd(result, number[i]);
23+
return result;
24+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy