我有一个非常简单的程序。我需要编写一个读取两个整数(赢、输)的程序。通过传递两个数字来调用这两个函数。显示获胜和失败百分比。我写了一个代码,但它没有计算和显示百分比。需要一些帮助。
#include<stdio.h>
double Win (double winns);
double Loss (double losses);
int main() {
int num1, num2, total;
double winns, losses, sum1, sum2;
printf("Enter the number of wins: ");
scanf("%d", &num1);
printf("Enter the number of losses: ");
scanf("%d", &num2);
total = num1 + num2;
winns = (num1/total)/100;
losses = (num2/total)/100;
sum1 = Win(winns);
sum2 = Loss(losses);
printf("The team's winning percent for the years was: %.2f\n", sum1);
printf("The team's losig percent for the years was: %.2f\n", sum2);
return 0;
}
double Win (double winns){
return (winns);
}
double Loss (double losses){
return (losses);
}