Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -40,8 +40,7 @@ public class GCD {
*/
public static int gcd(int[] number) {
int result = number[0];
for (int i = 1; i < number.length; i++) // call gcd function (input two value)
{
for (int i = 1; i < number.length; i++) { // call gcd function (input two value)
result = gcd(result, number[i]);
}
@ -49,10 +48,14 @@ public class GCD {
}
public static void main(String[] args) {
int[] myIntArray = {4, 16, 32};
int[] myIntArray = { 4, 16, 32 };
// call gcd function (input array)
System.out.println(gcd(myIntArray)); // => 4
System.out.printf("gcd(40,24)=%d gcd(24,40)=%d%n", gcd(40, 24), gcd(24, 40)); // => 8
System.out.printf(
"gcd(40,24)=%d gcd(24,40)=%d%n",
gcd(40, 24),
gcd(24, 40)
); // => 8
}
}