Operator precedence


   
 
/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/
/*
  Example3_10.cs illustrates operator precedence
*/

public class Example3_10
{

  public static void Main()
  {

    int myInt = 2 + 5 * 10;
    System.Console.WriteLine("2 + 5 * 10 = " + myInt);

    myInt = (2 + 5) * 10;
    System.Console.WriteLine("(2 + 5) * 10 = " + myInt);

    myInt = 2 * 20 / 5;
    System.Console.WriteLine("2 * 20 / 5 = " + myInt);

  }

}