求硬币总值。要求输入各种面值的硬币的数量,求总值。例如:1分钱35个,2分钱23个,5分钱10个,1角钱24个,5角钱20个, 则输出为13元7角1分

    xiaoxiao2023-10-19  155

    #include <stdio.h> int main() { int a,b,c,d,e; float s; printf(“分别输入1分钱2分钱5分钱1角钱5角钱的数量:”); scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); s=a*0.01+b*0.02+c*0.05+d*0.1+e*0.5; printf(“硬币总值为%g元\n”,s); }

    最新回复(0)