Programming Course in C# ¡Free!

How to multiple operations and precedence in C# Sharp

 Saturday, January 26, 2013 published by Exercises C#

Course > Basic concepts > How to multiple operations and precedence in C# Sharp
Create a C# program to print the result of the following operations:

-1 + 3 * 5
(24 + 5) % 7
15 + -4 * 6 / 11
2 + 10 / 6 * 1 - 7 % 2

Input

-

Output

14
1
13
2
using System;
public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine(-1 + 3 * 5);
        Console.WriteLine((24 + 5) % 7);
        Console.WriteLine((15 + -4 * 6 / 11));
        Console.WriteLine((2 + 10 / 6 * 1 - 7 % 2));
    }
}