#include<stdio.h>
void main()
{
float amount,interest,rate_int,new_amount;
int period,year;
rate_int=0.9;
printf("Amount =>");
if(scanf("%f",&amount)==1)
{
printf("Period");
if(scanf("%d",&period)==1)
{
for(year=0;year<=period;year++)
{
printf("%9.2f\t ",amount);
interest=amount*rate_int;
new_amount=amount+interest;
amount=new_amount;
printf("%2d\t %9.2f\n",year,new_amount);
}
printf("The new amount is Rs. %0.2f",new_amount);
}
else
{
printf("error,enter correct value");
}
}
else
{
printf("error,enter correct value");
}
}
===========================================OUTPUT========================
Amount =>12000
Period =>5
12000.00 0 22800.00
22800.00 1 43320.00
43320.00 2 82308.00
82308.00 3 156385.20
156385.20 4 297131.88
297131.88 5 564550.56
The new amount is Rs. 564550.50