O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arithmetic Operators and Numerical Expressions

You have already seen numerous examples of how C# performs arithmetic calculations by evaluating arithmetic expressions, such as the following:

  • 100 * Constants.MassOfElectron

  • ((distance1 + distance2) / 2)

These examples give you a general idea of how a correct expression is put together and how it is evaluated. However, you can only create expressions that efficiently solve the computational problems of your particular program, if you know the different underlying building blocks of a C# expression and how these are combined to form valid expressions. The following sections are aimed at providing you with this knowledge.

Arithmetic operators (such as addition (+), subtraction (-), multiplication ( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required