Exercises

Exercise 4-1.

Write a program that assigns the value 25 to variable x, and 5 to variable y. Output the sum, difference, product, quotient, and modulus of x and y.

Exercise 4-2.

What will be the output of the following method?

   static void Main(  )
   {
      int varA = 5;
      int varB = ++varA;
      int varC = varB++;
      Console.WriteLine( "A: {0}, B: {1}, C: {2}", varA, varB, varC );
   }
Exercise 4-3.

Write a program that demonstrates the difference between the prefix and postfix operators.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset