Sha256: 5441f6cc194de2482780a346acb07ec9f43815220d1d4eb46fe3c77343f81e22
Contents?: true
Size: 750 Bytes
Versions: 10
Compression:
Stored size: 750 Bytes
Contents
Adapted nearly verbatim from C# solution above. Note that I've used the exponentiation operator (**), but Math.Pow() as used in the C# solution would also work. using System; class Program { static Main(args : array[string]) : void { def a = Convert.ToInt32(args[0]); def b = Convert.ToInt32(args[1]); Console.WriteLine("{0} + {1} = {2}", a, b, a + b); Console.WriteLine("{0} - {1} = {2}", a, b, a - b); Console.WriteLine("{0} * {1} = {2}", a, b, a * b); Console.WriteLine("{0} / {1} = {2}", a, b, a / b); // truncates towards 0 Console.WriteLine("{0} % {1} = {2}", a, b, a % b); // matches sign of first operand Console.WriteLine("{0} ** {1} = {2}", a, b, a ** b); } }
Version data entries
10 entries across 7 versions & 1 rubygems