我是C#的新手.我一直致力于这个项目和研究,但我没有得到任何结果.目标是让用户输入数字(用户数量).当他们输入0时,它将停止程序并显示输入的最小数字,输入的最大数字以及输入的所有数字的平均值.我没有得到任何错误,我得到了.如果有人可以请我指出正确的方向.
WriteLines正在返回:
最小数字是0最高数字是0平均值是:0计数:5
这是我的代码:
int LOWEST =0;
int HIGHEST=0;
const int STOP = 0;
double average = 0;
int input;
int count = 0;
Console.WriteLine("Enter a number. You can end the program at anytime by entering 0");
input = Convert.ToInt32(Console.ReadLine());
while (input != STOP)
{
for (int i=0; input != STOP; i++)
{
Console.WriteLine("Enter a number. You can end the program at anytime by entering 0");
input = Convert.ToInt32(Console.ReadLine());
count++;
var Out = new int[] { input };
LOWEST = …Run Code Online (Sandbox Code Playgroud) c# ×1