滚动公平的Dut Guttag手指运动

时间:2019-02-16 02:04:09

标签: python python-3.x

我在进行另一次Guttag手指锻炼时遇到了麻烦。 问题显示为: “实现一个函数,该函数计算k个公平骰子中两个3的滚动概率。当k从2-> 100变化时,用于绘制概率”。这是我的代码,我缺少什么能够情节?

//Ask the user to enter five days of the week and rainfall data for each day

double rainsum = 0;

Console.WriteLine("Please enter 5 days of the week.");

//Store the data in a two dimensional string array named rainfallData[]
for (int i = 0; i < 2; i++)
{
  for (int j = 0; j < 5; j++)
  {
    rainfallData[i, j] = Console.ReadLine();
  }
  if (i == 0)
  {
    Console.WriteLine("Please enter the corresponding rain data.");
  }
}

Console.WriteLine("Data placed in raindallData[] array.");

for (int i = 0; i < 2; i++)
{
  Console.WriteLine();
  for (int j = 0; j < 5; j++)
  {
    Console.WriteLine("rainfallData({0},{1})={2}", i, j, rainfallData[i, j]);
  }
}

//Use iteration to calculate the following from the values in rainfallData[]:
//a) sum
Console.Write("Data values calculated using iteration. \n a) Sum of rainfallData[] = ");
for (int i = 1; i < rainfallData.Length; i++)
{
  Console.WriteLine();
  for (int j = 0; j < 5; j++)
  {
    rainsum += double.Parse(rainfallData[i, j]);
  }
}
Console.WriteLine(rainsum);

//End Program
Console.ReadKey(true);

0 个答案:

没有答案