Paste: pi
Author: | Crest |
Mode: | text |
Date: | Sun, 4 Jan 2009 17:53:24 |
Plain Text |
+-------------------------------------------------------------------------------+
| |
v |
(0,x,y) -+-> (1,x,y) -+- ( x != y ) -> (2,x,y) -+- ( x > y ) -> (3,x-y,y) -+-> (5,x,y) -+
| | |
| +- ( x <= y ) -> (4,x,y-x) -+
|
+- ( x == y ) -> (6,x,y)
Author: | Crest |
Mode: | text |
Date: | Sun, 4 Jan 2009 17:54:27 |
Plain Text |
0: public static int ggt( int x, int y )
{
1: while ( x != y )
{
2: if ( x > y )
{
3: x = x - y;
}
else
{
4: y = y - x;
}
5: }
6: return x;
}
New Annotation