You are on page 1of 1

Branching Home Work

1. Write a program that will prompt the user to enter his or her age and if
the user age is less than or equal to 18 display the message “You are too
young to go beyond this point”.

2. Modify the above program so that if the person age is greater than 18
years the program will print “You have been granted access”.

3. Write a program that will receive two numbers from the keyboard, and
display to the screen the quotient of the two numbers. Note that the
quotient calculation (first number divided by second number) is only to be
performed if the second number does not equal zero.

4. A computer repair shop charges $100 per hour for labour plus the cost of
any parts used in the repair. However, the minimum charge for any job is
$150. Write a program that will prompt the user for the number of hours
worked and the cost of parts (which can be $0) and then print the charge
for the job.

5. Write a program that will prompt the user to enter a number and then
display if the number is a positive or negative number.

6. A student is given 3 tests, each marked out of 100. The student passes if
their average mark is greater than or equal to 50 and fails if their
average mark is less than 50. Write a program that will prompt the user
for 3 marks and print Pass if the student passes and fail if the student
fails.

7. Write a program that will prompt the user to enter a number and then
display if the number is an odd or an even number.

8. Write a program which requests two weights in kilograms and grams and
prints the sum of the weights. For example, if the weights are 3kg 500g
and 4kg 700g, your program should print 8kg 200g.

You might also like