Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public long getGCD(long u, long v)
  2. {
  3. //may want to add a Thread.Sleep just to slow it down to simulate long calculation
  4. long gcd = 0;
  5.  
  6. u = Math.Abs(u);
  7. v = Math.Abs(v);
  8. if (v == 0)
  9. {
  10. gcd = u;
  11. }
  12. else
  13. {
  14. gcd = getGCD(v, u % v);
  15. }
  16. return gcd;
  17. }
Add Comment
Please, Sign In to add comment