Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _17.CalculateGCD
- {
- using System;
- class CalculateGCD
- {
- static void Main()
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int minValue = Math.Min(Math.Abs(a), Math.Abs(b));
- for (int i = minValue; i >= 0; i--)
- {
- if (a % i == 0 && b % i == 0)
- {
- Console.WriteLine(i);
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement