求1000和495的最大公因數
就想踢館這連結( https://zh.wikipedia.org/wiki/%E6%9C%80%E5%A4%A7%E5%85%AC%E5%9B%A0%E6%95%B8 )中的Java寫法, 想用最直覺方式求值,覺得連結中的有點高級或是太假掰XD,   /**   *   * @author lucrecia   */  public class Hk3_1 {      public static void main(String[] args) {          int m = 1000;          int n = 495;          List<Integer> list = new ArrayList<Integer>();          for (int i = 1; i < 1000; i++) {              if (m % i == 0 && n % i ==0) {                  list.add(i);              }          }          int maxValue = Collections.max(list);          System.out.println(maxValue);      }  }  
 
