O'Reilly logo

Microsoft® Visual C#® 2008 Step by Step by John Sharp

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

Using Arithmetic Operators

C# supports the regular arithmetic operations you learned in your childhood: the plus sign (+) for addition, the minus sign (–) for subtraction, the asterisk (*) for multiplication, and the forward slash (/) for division. The symbols +, –, *, and / are called operators because they "operate" on values to create new values. In the following example, the variable moneyPaid-ToConsultant ends up holding the product of 750 (the daily rate) and 20 (the number of days the consultant was employed):

long moneyPaidToConsultant;
moneyPaidToConsultant = 750 * 20;

Note

The values that an operator operates on are called operands. In the expression 750 * 20, the * is the operator, and 750 and 20 are the operands.

Operators and Types

Not ...

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