DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Kunal has posted 6 posts at DZone. View Full User Profile

GCD Of Two Numbers.

  • submit to reddit
        // finds GCD of a and b using Euclidian algorithm

public int GCD(int a, int b)
   if (b==0) return a;
   return GCD(b,a%b);