GCD

Run Settings
LanguageC#
Language Version
Run Command
using System; class MainClass { static void Main()//doesn't work with prime numbeers { Console.Write("First Int: "); int x = Convert.ToInt32(Console.ReadLine()); Console.Write(x+"\nSecond Int: "); int y = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(y); int z, GCD; bool first = true; if(x<y) { z = y%x; first = false; } else z = x%y; if(z==0) { if(first) GCD = y; else GCD = x; } else GCD = z; Console.WriteLine("GCD = {0}",GCD); } }
Editor Settings
Theme
Key bindings
Full width
Lines