Advertisement
SkeptaProgrammer

Untitled

Oct 16th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. public class Program
  5. {
  6. public static void Main()
  7. {
  8. int m, n;
  9. Console.WriteLine("Input m");
  10. m = Int32.Parse(Console.ReadLine());
  11. Console.WriteLine("Input n");
  12. n = Int32.Parse(Console.ReadLine());
  13. System.Diagnostics.Stopwatch swatch = new System.Diagnostics.Stopwatch();
  14. swatch.Start(); // старт
  15. while (m != n)
  16. {
  17. if (m > n) m = m - n;
  18. else n = n - m;
  19. }
  20.  
  21. swatch.Stop(); // стоп
  22. Console.WriteLine(swatch.Elapsed);
  23. Console.WriteLine("Nod =");
  24. Console.Write(m);
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement