CSC126 - Fundamental of Algorithms and Computer Problem Solving

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

CSC126 – Fundamental of Algorithms and Computer Problem Solving

Exercise

1. Write a program in C++ to calculate age of a student. Your algorithm should assign the current
year to a variable and obtain an input of year of birth from the user.

2. You are required to help the salesman to determine the commission that will be received. The
commission is 45% from the total sales. Write a program in C++ to solve the problem.

3. Write a program in C++ to determine the total marks for coursework if the student requires
taking 2 test and 2 assignments which each assessment contributes 20% and 30% respectively.
The score for every assessment is 100 before conversion.

4. Write a program in C++ to determine the perimeter and area of a circle. Use the appropriate
formula to calculate the perimeter and area of circle.

5. The charges for sms and calls are RM0.03/sms and RM 0.12/minute respectively. Write a
program in C++ to determine the total charges if the total sms is x and calls is y minutes.

6. Write a program in C++ to determine the total payment that could should be made if the
customer buys T-shirts with certain quantity and the price of each T-shirt is RM16.90.

7. You watch a movie at the cinema with several numbers of people. Given the ticket price is
RM19/person. Luckily, the cinema is offering discount 6% for each person. Write a program in
C++ to determine total price of ticket after discount, if x number of people watch the movie.

8. Write a program in C++ to receive five numbers from the user. Then determine the total and
average of all five numbers.

9. Every month, an employee receives a fixed amount of salary. The employee also would receive
bonus at the end of the year. Write a program to calculate and display the tax amount to be
paid by the employee based on his yearly income. The yearly income is calculated from his
total salary and bonus. The tax rate is 10% from the yearly income. (PYQ June 2019)

10. Write a program in C++ that prompt the user to enter a string to find the length of string.

11. Write a program in C ++ that prompt the user to enter two strings to concatenate one string
contents to another.

You might also like