O'Reilly logo

C# Primer Plus by Klaus Michelsen

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

Programming Exercises

In the following exercises, you are meant to change and add parts to the program in Listing 3.1 to make it perform the suggested actions.

1:Instead of printing “Bye Bye!” as the last text on the command console before the program finishes, change the source code so that the program writes “Bye Bye. Have a good day!”
2:Instead of typing a y to have the program print “Hello World!”, have the user type Yes. Have the program inform the user about this by changing line 10.
3:Instead of using the variable name answer to hold the input from the user, change the name to userInput.
4:Let the program print out an additional line under "Bye Bye. Have a good day!" saying "The program is terminating."
5:Declare another variable of type ...

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