Part 5 of 5 in Reading input and writing output  

Simple interest by harsha_s

Problem statement

Read the principle, annual rate of interest and number of months of a loan and print out the interest owed (formatted to 2 digits) at the end of the loan term. Simple interest equals priniciple * (yearly-rate-of-interest / 12) * number-of-months

Input

Three positive real numbers - principle, rate of interest (in %) and number of months of the loan. Sample input:

1000 13.5 6

Output

The rate of interest formatted to 2 digits after the decimal point. Test cases will be such that total interest is a multiple of 0.01 Sample output:

67.50

In the sample case shown above, we calculate interest at the rate of 13.5% per year for a period of 6 months (0.5 years) for a principle of 1000. The total interest is 67.5, which when formatted to 2 decimal places becomes 67.50

If the interest is less than 1 (say, 0.1) make sure you print it as 0.10 and not .1 or .10


To try out your code



Sign in

Sign up