Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public long getGCD(long u, long v)
- {
- //may want to add a Thread.Sleep just to slow it down to simulate long calculation
- long gcd = 0;
- u = Math.Abs(u);
- v = Math.Abs(v);
- if (v == 0)
- {
- gcd = u;
- }
- else
- {
- gcd = getGCD(v, u % v);
- }
- return gcd;
- }
Add Comment
Please, Sign In to add comment