SHARE
TWEET

Exercise8GreatestCommonDivisor

g-stoyanov Dec 4th, 2012 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class Exercise8GreatestCommonDivisor
  4. {
  5.     static int GCD(int a, int b)
  6.     {
  7.         if (b == 0)
  8.         {
  9.             return a;
  10.         }
  11.         else
  12.         {
  13.             return GCD(b, a % b);
  14.         }
  15.     }
  16.     static void Main()
  17.     {
  18.         int a = int.Parse(Console.ReadLine());
  19.         int b = int.Parse(Console.ReadLine());
  20.         Console.WriteLine(GCD(a, b));
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top