Public paste
datastructures
By: D | Date: Oct 29 2009 19:31 | Format: None | Expires: never | Size: 244 B | Hits: 872

  1. public static int euclid_iter(int m, int n)
  2.         {
  3.                 int x = m;
  4.                 int y = n;
  5.                 int d;
  6.                 //
  7.                 while(x!=y)
  8.                 {
  9.                         if(y>x)
  10.                         {
  11.                                 d = y-x;
  12.                                 y = d;
  13.                         }
  14.                         else if(y<x)
  15.                         {
  16.                                 d = x-y;
  17.                                 x = d;
  18.                         }
  19.                        
  20.                 }
  21.                 return(x);
  22.         }