Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Euklides
- {
- class Euklides
- {
- public static int nwd(int x, int y)
- {
- if (x != y)
- {
- if (x > y)
- {
- x = x - y;
- }
- else
- {
- y = y - x;
- }
- nwd(x, y);
- }
- return ((x < y) ? x : y);
- }
- public static void Main(string[] args)
- {
- int a, b;
- Console.Write("a = ");
- a = int.Parse(Console.ReadLine());
- Console.Write("b = ");
- b = int.Parse(Console.ReadLine());
- var eu = new Euklides();
- Console.WriteLine("NWD = " + nwd(a, b));
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement