The objective of this assignment is to use all three loop types AND the switch
statement.
You are to write a menu driven program (good place for a do loop) that
has three options (good place for a switch statement):
- Count up to N by Step: Use a for loop
Request the numbers(i.e., N and Step) from the user and output the numbers from 1 to N.
If N is below 1, output an error message.
- Count down to N by Step: Use a for loop
Request the numbers (i.e., N and Step) from the user and output the numbers from N down to 1.
- Base 2 conversion - Use a while loop
Request a base 10 number between 1 and 1,000 and report the binary equivalent of
the number.
The program must:
- Use a do loop for the menu
- Use a switch statement
- Use a two for loops for counting
- Use a while loop for the base 10 to base 2 conversion
To hand this program in, place the code
in the Assign4 folder in D2L.
Need some help? Try this
Binary conversion code Try this