using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication29 { class Program { static void Main(string[] args) { int a, b; int i = 0; Console.WriteLine("Podaj liczbę: "); while (!int.TryParse(Console.ReadLine(), out a)&& a<=0) Console.WriteLine("Błędna wartość, podaj jeszcze raz..."); Console.WriteLine("Podaj drugą liczbę: "); while (!int.TryParse(Console.ReadLine(), out b)&& b <=0) Console.WriteLine("Błędna wartość, podaj jeszcze raz..."); while(a!=b) { if (a > b) { a = a - b; i++; Console.WriteLine("{2}. A= {0} B= {1}", a, b, i); Console.WriteLine(" "); } else { b = b - a; i++; Console.WriteLine("{2}. A= {0} B= {1}", a, b, i); Console.WriteLine(" "); } } Console.WriteLine("NWD = {0}",a); Console.ReadKey(); } } }