sdsdfdu

Untitled

May 2nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. using System.IO;
  2. using System;
  3. class Euclid
  4. {
  5.     static void Main()
  6.     {  
  7.         Console.Write("Input 1: ");
  8.         int x = Convert.ToInt32(Console.ReadLine());
  9.         Console.Write("Input 2: ");
  10.         int y = Convert.ToInt32(Console.ReadLine());
  11.         while(x != y)
  12.         {
  13.             Console.WriteLine(X + "\t" + y);
  14.             if(x > y)
  15.                 x -= y;
  16.             else
  17.                 y -= x;
  18.         }
  19.         Console.WriteLine(x + "\t" + y);
  20.         Console.WriteLine("GCD: {0}",x);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment