#C13534. Compound Interest Calculation
Compound Interest Calculation
Compound Interest Calculation
You are given an initial balance, an annual interest rate (in percent), and a number of years. Your task is to calculate the final balance after applying compound interest using the formula:
$$Final = Initial \times \left(1+\frac{Rate}{100}\right)^{Years}$$
If the computed final balance is an integer, output it without any decimal point. If the calculated result is non-integer and the elapsed time is fractional, round the result to two decimal places. Otherwise, if the elapsed time is an integer and the result includes a non-zero fractional part, output it without unnecessary trailing zeros (for example, output 1102.5 instead of 1102.50).
inputFormat
The input consists of a single line with three numbers separated by spaces: initial_balance
, annual_interest_rate
, and years
. Note that years
may be a fractional number.
outputFormat
Output the final balance after applying compound interest. If the result is a whole number, print it without a decimal point. If the result is a non-integer and the elapsed years is fractional, round the output to two decimal places; otherwise, output the result with minimal necessary decimals.## sample
0 5 5
0