The area of a triangle can be calculated by any one of the two different formulas given below.
Using C++
Exercise 1
The area of a triangle can be calculated by any one of the two different formulas given below.
a. Using the basic formula: Area = * base * height /* The formula has to be used when base and height of the triangle are known*/.
b. Using the Heron’s formula: Area = Where a,b and c are the sides of the triangle and s is called the semi perimeter and s =
(a+b+c). /* This formula must be used when the values for the sides of the triangle are known*/
Note: You can use the sqrt() function provided in cmath library.
Exercise 2
When you borrow money to buy a house, a car, or for some or for some other purposes, then you typically repay it by making periodic payments. Suppose that the loan amount is A, r is the rate of interest per year, m is the number of payments in a year, and the loan is for t years. Suppose that i = (r/m) and r is in decimal, then the periodic payment is:
Develop and the function that returns the periodic payment. The amount loaned, rate of interest and the number of payments in a year must be input by the user.
Note:
You can use the pow function provided in cmath library to evaluate any expression that has power (or exponent).
Sample input/output:
Enter the amount in AED: 100000.00
Enter interest rate: 0.05
Enter number of years: 5
Enter number of payments in a year: 12
Periodic payment (per month) is: 1887.12
Total amount paid in AED is: 113227.00
Press any key to continue . . .
11 years ago
Purchase the answer to view it

- the_code.zip