现在的位置: 首页 > 综合 > 正文

pow函数使用

2017年10月17日 ⁄ 综合 ⁄ 共 505字 ⁄ 字号 评论关闭
/*#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
    float p,r,n;
    r=0.1;n=10;
    p=pow(1+r,n);//pow函数用来求y^x的值,调用pow函数形式为pow(y,x) 
    printf("%f\n",p);
    system ("pause");
    return 0;
    }
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
    float p1,p2,p3,p4,p5,r1,r2,r3,r5,r;
    r1=0.0414;
    r5=0.0585;
    r2=0.0468;
    r3=0.054;
    r=0.0072;
    p1=1000*((1+r5)*5);
    p2=1000*(1+2*r2)*(1+3*r3);
    p3=1000*(1+3*r3)*(1+2*r2);
    p4=pow(1+r1,5)*1000;   
    p5=1000*pow(1+r/4,4*5);
    printf ("%f\n%f\n%f\n%f\n%f\n",p1,p2,p3,p4,p5);
    system ("pause");
    return 0;
    }


 

 

抱歉!评论已关闭.