1.4 Multiple operations and precedence

Objetive

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


Solution

public class MultipleOperations
{
    public static void Main()
    {
        System.Console.WriteLine(-1+3*5);
        System.Console.WriteLine((24+5)%7);
        System.Console.WriteLine(15+-4*6/11);
        System.Console.WriteLine(2+10/6*1-7%2);
    }
}



Popular Posts