Branching: Mmiv July XXV Sat
Branching: Mmiv July XXV Sat
Branching
1. Write a program that prompts the user to input a number. The program should then output the
number and a message saying whether the number is positive, negative, or zero.
2. Write a program that prompts the user to input an integer between 0 and 35. If the number less than
or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11,
C for 12, , and Z for 35.
3. Write a program that prompts the user to input the x-y coordinate of a point in a Cartesian plane.
The program should then output a message indicating whether the point is the origin, is located on
the x- (or y-) axis, or appears in a particular quadrant.
4. Write a program that prompts the user to input an integer and then outputs the number with the
digits reversed. For example, if the input is 5000, the output should be 0005.
5. Write a program prompts the user to input an elapsed time. If the elapsed time entered is in seconds
convert to hours, minutes and seconds otherwise output its equivalent quarter hours.
6. Write a program that prompts the user to enter the base and altitude of a right triangle as well as its
corresponding code. If the code entered is A or a compute and print the area, else if code entered
is P or p compute and print the perimeter otherwise not A a or P p print the remark
Invalid Code and Try Again.
7. Write a program to input both integers a and b and then indicate whether a is multiple of b or a is
not multiple of b.
8. Write a program that reads 5 numbers and then find the sum. Determine whether the sum
generated is it even or odd.
9. Suppose a, b, and c denote the lengths of the sides of a triangle. If it has right angle display its area
and the remark A Right Triangle. Else if it is more than 90 degrees display its area and the
remark An Oblique Triangle. Else display the remark You better name it what does it called
for?
10. Tennis balls are priced $2 each if the number of purchased is at least 10 otherwise its $9 if it is
lesser 10. Print the total cost.
11. A pastry maker is offered a choice of 2 wage plans to choose. Option 1 is 20% commission for
every pastry sold out in a week. Option 2 is set through P50 per hour for 8 hours. Code a program
that takes the predictable sales and then outputs the 2 wage plans as well as saying which of the 2
wage plans is the best paying plan.
12. Print the equivalent Roman Numeral for the decimal number entered.
1000
M
500
D
100
C
50
L
10
X
5
V
1
I