Prelim Machine Exercises

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

PROGRAMMING II MACHINE EXERCISES

DEADLINE ON OR BEFORE JANUARY 2, 2011 LATE SUBMISSION WILL NOT BE ENTERTAINED. STRICTLY NO COPYING FROM YOUR CLASSMATES AND IN THE INTERNET! Exercises are just minor program while Machine Exercise is a Major Program.

Format for submission: Folder Name: yourname_Year&Block Format for individual program exercise: exercisename#_lastname.cpp Note: Follow the correct format given, those who did not follow the format, programs will not be accepted! Those who will submit early will be given extra points. Submit it to me in person. Only soft copy.

EXERCISE 1 Write a program that asks the user to type an integer and writes "YOU WIN" if the value is between 56 and 78 (both included). In the other case it writes "YOU LOSE".(Hint Use if else statement) EXERCISE 2 Write a program that asks the user to type all the integers between 8 and 23 (both included) using a for loop.

EXERCISE 3 Same exercise but you must use a while.

MACHINE EXERCISE 4 Write a program that is able to compute some operations on an integer. The program writes the value of the integer and writes the following menu (USE CASE STATEMENT HERE) a. Add 10 b. Multiply by 2 c. Subtract 4 d. Divide by 8 e. Quit

The programs ask the user to type a value between a and e. If the user types a value from a to d the operation is computed, the number is written and the menu is displayed again. If the user types e, the program quits. Note in this program, when you choose a it is the same as A, these goes for all. MACHINE EXERCISE 5: Create a program that will output a diamond pattern as shown below.

MACHINE EXERCISE 6

Simplified Program for Machine Exercise 5: Print out the following triangular patter

Happy holidays!
~ maze ~

You might also like