Control Structures
Control Structures
Problem 1
Write a C program to find sum of 10 positive numbers
Problem 2
Write a menu driven program, to find the Addition, Subtraction, Division &
multiplication of the 2 given numbers
Problem 3
Given the number of hours an employee worked and the hourly wage, compute
the employee’s weekly pay. Count any hour over 40 as overtime. Consider
every 1 hr overtime as 1hr 30 mins (1 hr OT = 1hr 30 min).
Problem 4
Write a program to add an 8% sales tax to any commodity purchases and round
the price accordingly.
Problem 5
Write a program to convert the month number to the month name
Problem 6
Write a program that calculates how much money a person earns over a period
of time (entered by user), if he is working on the following salary pattern:
100 Rs: 1st week
150 Rs: 2nd week
200 Rs: 3rd week
250 Rs: 4th week
Problem 7
Chuckie Lucky won a million Rs, which he places in an account that earns 8%
a year. On the last day of each year, Chuckie withdraws Rs 100,000. Write a
program that finds out how many years it takes for Chuckie to empty his
account.
Problem 8
Amit invests Rs. 1000 at 10% simple interest. (That is, every year, the
investment earns an interest equal to 10% of the original investment). Anand
invests Rs1000 at 5% interest compounded annually. (That is, interest is 5% of
the current balance, including previous addition of interest.) Write a program
that finds how many years it takes for the value of Anand's investment to
exceed the value of Amit's investment. Also show the two values at that time.
Problem Statement 9
The ABC Mail Order Grocery sells artichokes for Rs. 2.25 per kg, beets for Rs.
5.65 per kg, and carrots for Rs. 10.89 per kg. They give a 5% discount for
orders of Rs. 1000 or more prior to adding shipping costs. They charge Rs.
3.50 shipping and handling for any order of 20 kg or under, Rs. 7.00 shipping
and handling for orders over 20 kg and under 25 kg, and Rs. 10.50 plus Rs.
1.00 per kg for shipments of 25 kg or more. Create following menu to take user
input:
----------------------------------------------------------------------------------------------------
Grocery Menu
A: To enter quantity of artichokes desired in kgs.
B: To enter quantity of beets desired in kgs.
C: To enter quantity of carrots desired in kgs.
D: To Quit
The user has to enter one of the above characters (A, B, C or D) to enter
appropriate information. Use switch statement in a loop to achieve this. The
program then should compute the total charges, the discount if any, the
shipping charges, and the grand total. The program then should display all the
purchase information: the cost per kg, the quantity ordered, the total cost of the
order, the discount, the shipping charge, and the grand total of all the charges.