Advertisement
dim4o

Loops_17_CalculateGCDvar1

Mar 26th, 2014
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. static void Main()
  2.         {
  3.             int a = int.Parse(Console.ReadLine());
  4.             int b = int.Parse(Console.ReadLine());
  5.             int remain = a % b;
  6.             while (remain != 0)
  7.             {
  8.                 a = b;
  9.                 b = remain;
  10.                 remain = a % b;
  11.             }
  12.             Console.WriteLine(Math.Abs(b));
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement