#include <stdio.h>
int main() {
double principal, interest;
double years;
printf("请输入存款本金和期限(以空格分隔):");
scanf("%lf %lf", &principal, &years);
if (years == 0.5) {
interest = principal * 0.0255;
} else if (years == 1.0) {
interest = principal * 0.0275;
} else if (years == 2.0) {
interest = principal * 0.0335;
} else if (years == 3.0) {
interest = principal * 0.04;
} else if (years == 5.0) {
interest = principal * 0.0475;
} else {
printf("存款期限不正确!\n");
return 1;
}
double total = principal + interest;
printf("存款到期本金为:%.2f,利息为:%.2f,合计:%.2f\n", principal+interest, interest, total);
return 0;
}
