GCD using Euclid algorithm.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
class Program
{
static void Main()
{
int a = 8, b = 15;
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.