#include <stdio.h> #include <math.h> int main(void) { int year; double loan,money,my,rate; scanf_s("%lf",&loan);/*读入loan和rate*/ scanf_s("%lf",&rate); printf("year money "); for(year=5;year<=30;year++){ /*利用循环计算算式*/ my=pow(1+rate,12*year); money=loan*rate*my/(my-1); printf("year=%d money=%.0f ",year,money); } return 0; }