#include <stdio.h>
#include <conio.h>
main() {
float num1, num2, num3, num4, num5, sum;
printf("Enter a Number between");
fflush;
scanf("%f",&num1);
fflush;
printf("Enter a Number between");
scanf("%f",&num2);
fflush;
printf("Enter a Number between");
scanf("%f",&num3);
fflush;
printf("Enter a Number between");
scanf("%f",&num4);
fflush;
printf("Enter a Number between");
scanf("%f",&num5);
fflush;
sum = num1 + num2 + num3 + num4 + num5;
printf("The sum of the five numbers you have entered is %f",sum);
getch();
}
我是c编程的新手。我们有一个任务,我已经创建了上面的代码。但我们需要一个更短的解决方案。用户必须输入五个数字并显示总和。你能帮我用 do while 函数或后测试循环翻译这段代码吗?非常感谢您!