21天养成良好习惯-14
#include <stdio.h>#include <stdlib.h>#include <math.h>int main(){ double rate,capital,deposit; int year; char x; printf(“Input rate, year, capital:”); scanf("%lf,%d,%lf",&rate,&year,&capital); printf(“Compound interest (Y/N)?” ); scanf(" %c",&x); if(x==‘y’||x==‘Y’) { deposit=capitalpow((1+rate),year); printf(“deposit = %.4f\n”,deposit); } else { deposit=capital(1+rate*year); printf(“deposit = %.4f\n”,deposit); } return 0;}