Section 4.7. Exercises


4.7. 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.



Learning C# 2005
Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)
ISBN: 0596102097
EAN: 2147483647
Year: 2004
Pages: 250

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net