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.