Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ExamProblem2
- {
- class Program
- {
- public static int NOD(int a, int b)
- {
- if (a > b)
- {
- return NOD(a - b, b);
- }
- if (b > a)
- {
- return NOD(a, b - a);
- }
- return a;
- }
- static void Main(string[] args)
- {
- string[] inputInfo = Console.ReadLine().Split(' ').ToArray();
- int a = int.Parse(inputInfo[0]);
- int b = int.Parse(inputInfo[1]);
- int c = int.Parse(inputInfo[2]);
- int d = int.Parse(inputInfo[3]);
- int nod1 = NOD(a, b);
- int nod2 = NOD(c, d);
- Console.WriteLine(NOD(nod1, nod2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement