Advertisement
dim4o

Loops_17_CalculateGCDvar2

Mar 26th, 2014
356
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 = 1;
  6.             while (remain != 0)
  7.             {
  8.                 remain = a % b;
  9.                 a = b;
  10.                 b = remain;    
  11.             }
  12.             Console.WriteLine(Math.Abs(a));
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement