two left
This commit is contained in:
29
labs/lab3_done/Euclid/Program.cs
Normal file
29
labs/lab3_done/Euclid/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
int a, b, temp;
|
||||
|
||||
Console.Write("input a:");
|
||||
a = int.Parse(Console.ReadLine());
|
||||
Console.Write("input b:");
|
||||
b = int.Parse(Console.ReadLine());
|
||||
|
||||
temp = a;
|
||||
while (temp != b)
|
||||
{
|
||||
a = temp;
|
||||
if (a < b)
|
||||
{
|
||||
temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
temp = a - b;
|
||||
a = b;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user