Programming: & Problem Solving Lab (Assignment - 2)
Programming: & Problem Solving Lab (Assignment - 2)
Assignment 2
Programming & Problem Solving Lab(Assignment – 2)
1. Using six if statements (equality & relational operators) to compare two numbers input by user. If
the condition in any of these if statement is satisfied, the printf statement associated with that if is
executed.
2. Develop a c program that will determine if a department store customer has exceeded the credit
limit on a charge account. For each customer, the following facts are available:
i. Account number
ii. Balance of the beginning of the months
iii. Total of all items charged by this customer this months
iv. Total of all credits applied to this customer’s account this month
v. Allowed credit limit
This program should input each of these facts, calculate the new balance (=beginning balance +
charges - credits), and determine if the new balance exceeds the customer’s limit. For those
customers whose credit limit is exceeded, the program should display the customer’s account
number, credit limit, new balance and the message “credit limit exceeded.”
Enter account number (-1 to end): 100
Enter beginning balance: 5394.78
Enter total charges: 1000.00
Enter total credits: 500.00
Enter credit limit: 5500.00
Amount: 100
Credit limit: 5500.00
Balance: 5894.78
Credit limit exceeded
The preceding formula assumes that rate is the annual interest rate, and therefore includes the
division by 365 (days). Develop a program that will input principal, rate and days for several loans,
and will calculate and display the simple interest for each loan, using the preceding formula.
5. Because of the price of gasoline, drivers are concerned with the mileage obtained by their
automobiles. One driver has kept track of several tankful of gasoline by recording miles driven
and gallons used for each tankful. Develop a program that will input the miles driven and gallons
used for each tankful. The program should calculate and display the mules per gallons used for
each thankful. The program should calculate and display the miles per gallon obtained for each
thankful. After processing all input information, the program should calculate and print the
combined miles per gallon obtained for all tankfuls.
6. When three angle of triangle enter from key board, check the triangle is valid or not.
7. Write a program to compute grade of students using if else adder. The grades are assigned as
followed:
a. Marks Grade
b. marks<50 F
c. 50≤marks< 60 C
d. 60≤marks<70 B
e. 70≤marks<80 B+
f. 80≤marks<90 A
g. 90≤mars≤ 100 A+