107 307
Assignments Done
98.9%
Successfully Done
In March 2023

# Answer to Question #59702 in C# for Anthony Allen

Question #59702
The average of the 20 random numbers is 71

Enter a double value 11.11
Enter a double value 22.22
Enter a double value 33.33
Enter a double value 44.44
Enter a double value 55.55
The total is 166.65
Press any key to continue
1
2016-05-04T09:40:02-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;

namespace rand
{
class Program
{
static void Main(string[] args)
{
Random rand = new Random();
double[] mas = new double[20];
double sum = 0;
for (int i = 0; i < 20; i++)
{
mas[i] = rand.Next(0, 1000);
sum += mas[i];
Console.WriteLine((i+1) + " number is "+mas[i].ToString());
}
Console.WriteLine();
Console.WriteLine("The Total is: " + sum.ToString());
Console.WriteLine("The average of the 20 random numbers is: " + (sum / 20.0).ToString());
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!