// invest.c
// DAY05//// Print an investment rate statement// print 100 yuan for investment in the specified year, and return the proceeds in accordance with the corresponding rate of return. Program output is as follows:
// rate: 6% Year: 5/// 6% 7% 8% 9% 10%
// 1 108 109/
/ 2 112.36 114.49 116.64 118.81 121
// 3 119.10 122.50
125.97 129.50 133.10/ 4
// 5
// Created by Apple on 13-6-6. Copyright (c) 2013 Apple. All rights reserved.
#include <stdio.h>
//rates are calculated iteratively.
double Income (int y,double r) {
double i = 0.0;
if (y==1) {
i = m * (1 + R);
printf ("%.2lf\n", I);
} else{
Y-= 1;
i = income (y, R) * (1 + R);
printf ("%.2lf\n", I);
}
return i;
}
int main ()
{
int year = 0;
Double rate = 0.0;
printf ("Please enter interest rate:");
scanf ("%lf", &rate);
printf ("Please enter Year:");
scanf ("%d", &year);
Income (year,rate);
return 0;
}