diff options
author | Igor <pashev.igor@gmail.com> | 2011-01-14 18:04:41 +0300 |
---|---|---|
committer | Igor <pashev.igor@gmail.com> | 2011-01-14 18:04:41 +0300 |
commit | 0475936b4046273a34249b4337629c4ab82f1683 (patch) | |
tree | e94217ae8d94f856a52fa376a28327f904f7a6ad | |
parent | cb9ab4e10b97f91bcf78fc643821851097a54e7e (diff) | |
download | gcd-0475936b4046273a34249b4337629c4ab82f1683.tar.gz |
Tabs to spaces
-rw-r--r-- | gcd.java | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,28 +1,28 @@ public class gcd { - public static int gcd2(int a, int b) { - int c; + public static int gcd2(int a, int b) { + int c; while (b != 0) { c = b; b = a % b; a = c; } - return a; - } + return a; + } - public static int gcdn(int [] a) { - int r = a[0]; + public static int gcdn(int [] a) { + int r = a[0]; for (int i = 1; i < a.length; i++) r = gcd2(r, a[i]); - return r; - } + return r; + } - public static void main(String [] argv) { + public static void main(String [] argv) { int [] n = new int [argv.length]; for (int i = 0; i < argv.length; i++) { n[i] = Integer.parseInt(argv[i]); } System.out.println(gcdn(n)); - } + } } |