Arithmetic/Integer: Difference between revisions

→‎{{header|C sharp|C#}}: fixed parenthesis + removed error handling + minor edits
(→‎{{header|C sharp|C#}}: fixed parenthesis + removed error handling + minor edits)
Line 152:
class Program
{
static void Main(string[] args)
{
int a = Convert.ToInt32(args[0]);
if (args.Length < 2)
int returnb = Convert.ToInt32(args[1]);
 
Console.WriteLine("a{0} /+ b{1} = {02}", a, b, a /+ b);
int a = Convert.ToInt32(args[0]);
Console.WriteLine("a{0} %- b{1} = {02}", a, b, a %- b);
int b = Convert.ToInt32(args[1]);
Console.WriteLine("a{0} to* the power of b{1} = {02}", Math.Pow(a, b, a * b)(;
 
Console.WriteLine("a{0} -/ b{1} = {02}", a, -b, a / b); // truncates towards 0
Console.WriteLine("a{0} *% b{1} = {02}", a, *b, a % b); // matches sign of first operand
Console.WriteLine("{0} to the power of {1} = {2}", a, b, Math.Pow(a, b));
if (b != 0)
{}
Console.WriteLine("a / b = {0}", a / b);
Console.WriteLine("a % b = {0}", a % b);
}
Console.WriteLine("a to the power of b = {0}", Math.Pow(a, b)(;
}
}</lang>
Sample output:
<lang>5 + 3 = 8
5 - 3 = 2
5 * 3 = 15
5 / 3 = 1
5 % 3 = 2
5 to the power of 3 = 125</lang>
 
=={{header|Chef}}==
Anonymous user