Vi. arithmetic appended mathematical operators

Source: Internet
Author: User

using system;using system.collections.generic;using system.linq;using system.text; Namespace _6. Operator's mathematical operator {    class program    {         static void main (String[] args)          {            //  Add, subtract, multiply , divide and withdraw operators             {                 int intVar1 = 53,  intvar2 = 6;                 float floatVar = 52.54F;                 double doubleVar = 23.21;                                  console.writeline ("{0} + {1} = {2}", intvar1, floatvar,  Intvar1 + floatvar);                 console.writeline ("{0} - {1} = {2}", intvar1, intvar2,  INTVAR1&NBSP;-&NBSP;INTVAR2);                 console.writeline ("{0} * {1} = {2}", intvar1, intvar2,  INTVAR1&NBSP;*&NBSP;INTVAR2);                 console.writeline ("{0} * {1} = {2}", intvar2, doublevar,  Intvar2 * doublevar);                 console.wRiteline ("{0} / {1} = {2}", &NBSP;INTVAR1,&NBSP;INTVAR2,&NBSP;INTVAR1&NBSP;/&NBSP;INTVAR2);                  Console.WriteLine ("{0} / {1} = {2}",  intvar2, doublevar, intvar2 /  doublevar);                 console.writeline ("{0} % {1} = {2}",  intvar1, intvar2, intvar1 % &NBSP;INTVAR2);                 console.writeline ("{0} % {1} = {2}",  intvar1, doublevar, intvar1  % doublevar);            }                          //  positive and negative operators             {                 int var = -1;                                  console.writeline ("var: {0}",  var);                 //  The positive sign operator has no effect on the result.                  Console.WriteLine ("+var: {0}",  +var);                 console.writeline ("-var: {0}",  -var);             }                         //  string Join operator (+)              {                 string stringVal1 =  "hello, ";                 string stringVal2 =  "world!";                                  string stringresult  = stringVal1 + stringVal2;                 console.writeline ("stringresult: {0}",  stringresult);             }                         //  self-increment, decrement operator              {                 // 1.  put the operator before the operand, the operand is affected by the operator before any other calculations are made.                 // 2.   After the operator is placed behind the operand, the operand is affected by the operator after the completion of the evaluation of the expression.                 int var1  = 5, var2 = 3;                                  console.writeline ("Var1: {0}, ++var1: {1}, var1: {2}",  var1, &NBSP;++VAR1,&NBSP;VAR1);                &nbsp Console.WriteLine ("Var1: {0}, --var1: {1}, var1: {2}", var1, --var1,  VAR1);                 Console.WriteLine ("Var2: {0}, var2++: {1}, var2: {2}", var2, var2++,  VAR2);                 Console.WriteLine ("Var2: {0}, var2--: {1}, var2: {2}",  var2, var2--,   VAR2);            }                          /**             *  Math Assignment Operators               *  its syntax format:              *  <variable> += <expression> ==> < variable> = <variable> +  (<expression>)               *  <variable> -= <expression> = => <variable> = <variable> -  (<expression>)               *  <variable> *= < expression> ==> <variable> = <variable> *  (<expression>)              *  <variable>  /= <expression> ==> <variable> = <variable> /  ( <expression>)              *   <variable> %= <expression> ==> <variable> = <variable> %  (< expression>)              *   The             * += operator can also be applied to string joins.              */                           console.readkey ();         }    }}


This article is from the "MK IT Life" blog, so be sure to keep this source http://vikxiao.blog.51cto.com/9189404/1585748

Vi. arithmetic appended mathematical operators

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.