public void Main(string[] args)
for (int i = 0; i < 20; i++)
randomValue = (int)DateTime.Now.TimeOfDay.Ticks + i;
totalValue += getRandom(randomValue);
calculate(ref avgValue, totalValue, 20 );
Console.WriteLine("The average of the 20 random numbers is " + avgValue);
for (int i = 0; i < 5; i++)
Console.WriteLine("Enter a double value ");
inputValue = Convert.ToDouble(Console.ReadLine());
calculate(ref totalValue, inputValue);
Console.WriteLine("The total is " + totalValue);
static int getRandom(int seed)
Random myRandVal = new Random(seed);
int randVal = myRandVal.Next(1, 100);
static void calculate(ref double avg, double randVal, int numberOfItems )
avg = randVal / numberOfItems;
static void calculate(ref double totalValue, double entryValue)
totalValue += entryValue;