Section 5.6. Exercises


5.6. Exercises



Exercise 5-1 .

Create a method that counts from 1-10 using each of the while , do...while , and for statements.



Exercise 5-2 .

Create a program that evaluates whether a given input is odd or even; a multiple of 10, or too large (over 100) by using four levels of if statement. Then expand the program to do the same work with a switch statement.



Exercise 5-3 .

Create a program that initializes a variable i at 0 and counts up, and initializes a second variable j at 25 and counts down. Use a for loop to increment i and decrement j simultaneously . When i is greater than j , end the loop and print out the message "Crossed over!"



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