Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Exercise8GreatestCommonDivisor
- {
- static int GCD(int a, int b)
- {
- if (b == 0)
- {
- return a;
- }
- else
- {
- return GCD(b, a % b);
- }
- }
- static void Main()
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- Console.WriteLine(GCD(a, b));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement