c语言编程练习题:7-129 最佳情侣身高差
作者:yunjinqi   类别:    日期:2023-05-31 16:51:23    阅读:128 次   消耗积分:0 分    

image.png

#include <stdio.h>
int main(){
    int n;
    char gender;
    double height;
    double t;
    if (scanf("%d",&n)!=EOF){
        double target[10];
        int count=0;
        for(int i=0;i<n;i++){
		    if (scanf(" %c %lf",&gender,&height)!=EOF){
                // printf("%d %d %c %lf\n",n,i,gender,height);
                if (gender=='F'){t=height*1.09;target[count]=t;count++;}
                if (gender=='M'){t=height/1.09;target[count]=t;count++;}
                // printf("%d %d %c %lf\n",n,i,gender,height);
            }
            
        }
        for (int i=0;i<n;i++){
            printf("%.2f\n",target[i]);
        }


    }
    else{
        printf("input wrong");
    }
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/254
上一篇:c语言编程练习题:7-128 大于m的最小素数
下一篇:c语言编程练习题:7-130 累加器