GCD using Euclid algorithm.
Ready — edit the code above and click Run.
using System;
class Program
{
static void Main()
{
int a = 7, b = 14;
while (b != 0) { int t = b; b = a % b; a = t; }
Console.WriteLine(a);
}
}
Try solving on your own first, then reveal the official answer.
Euclidean algorithm.