Rethink the strategy of calculating the amount. I know it as empowering the added rate for years. If the rate is in percent you must divide by 100. (As I coded).

Your time input is used. That you must solve for yourself.

C++

float principal, rate, time, n, a;//or double a = principal*pow(1+rate/100,n);

Maybe you add a hint that the input can have some fracton seperated with a "."