1.04: Multiple Operations and Precedence

OBJECTIVE

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 

RESOLUTION

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;

namespace My3Development
{
 class Multiple Operation
 {
     static void Main(string[] args)
     {
        Console.WriteLine("-1+3*5\t\t= "+(-1+3*5));
        Console.WriteLine("15+-4*6/11\t= "+(15+-4*6/11));
        Console.WriteLine("2+10/6*1-7%2\t= "+(2+10/6*1-7%2));
        Console.WriteLine("(24+5)%7\t= "+((24+5)%7));
        Console.ReadKey();
       
        }
    }
 }

DEMO RESULT


         PREVIOUS                                             HOME                                                NEXT

0 comments :

Please Enter best of your Comments