编程语言
首页 > 编程语言> > 简单的编程题4

简单的编程题4

作者:互联网

 

此题异常简单,代码如下,无注释

 

#include<stdio.h>
#include<math.h>
float hs(int a,int b,int c){
    float s;
    s=(4.25*(a+b)+log(a+b+sqrt(a+b)+1/(a+b)))/(4.25*c+log(c+sqrt(c)+1/c));
    return s;
}

int main(){
    int a,b,c;
    float m;
    FILE *fp=fopen("data.txt","w+");
    if(fp==0)
    printf("erreo");
    for(int i=0;i<10;i++){
        printf("请输出第%d组abc的值\n",i+1);
        scanf("%d%d%d",&a,&b,&c);
        float hs(int a,int b,int c);
        m=hs(a, b, c);
        printf("%f\n",m);
        fprintf(fp,"T%d=%f\n",i+1,m);
    }
    fclose(fp);
    return 0;
}

 

标签:fp,编程,log,int,float,sqrt,简单,4.25
来源: https://www.cnblogs.com/mayang150/p/hanshu.html