← 都来码 / Dolaima← 例程索引c/school/ch03_3-2.c 原文

c/school/ch03_3-2.c · 414 字节 · 下载原文

#include <stdio.h>
#include <math.h>

int main(){

    double p1,p2,p3,p4,p5,r1=0.015,r2=0.021,r3=0.0275,r5=0.03,r6=0.0035;
    p1 = 1000*(1+5*r5);
    p2 = 1000*(1+2*r2)*(1+3*r3);
    p3 = 1000*(1+3*r3)*(1+2*r2);
    p4 = 1000*pow(1+r1,5);
    p5 = 1000*pow(1+r6/4,4*5);

    printf("%.2f\n",p1);
    printf("%.2f\n",p2);
    printf("%.2f\n",p3);
    printf("%.2f\n",p4);
    printf("%.2f\n",p5);

    return 0;
}