68 369
Assignments Done
98,7%
Successfully Done
In November 2018

Answer to Question #4810 in C# for sonu

Question #4810
please anyone can create this program........
Write a method that finds the average of a set of numbers passed to it as params parameter.Also write code to print the above average from the invoking method using an out parameter.
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Findstheaverageofasetofnumbers
{
class Program
{

static void Main(string[] args)
{
int number=0;
double avaregenumber;
double [] arrayof=new double[100];


Console.WriteLine("Enter size of array:"); // Display
value
number=int.Parse(Console.ReadLine());
Console.WriteLine("Enter numbers:"); // Displ
for (int i = 0; i < number; i++) {
arrayof[i] = double.Parse(Console.ReadLine());
}
Findstheaverage(arrayof, out avaregenumber, number);
Console.WriteLine("The answer: "+avaregenumber.ToString()); // Display
value
Console.ReadLine();
}
static void Findstheaverage(double [] arrayof, out double avaregenumber,int count)
{
double number=0;
for (int i = 0; i < count; i++)
{
number+=arrayof[i];

}
avaregenumber = number / count;


}
}
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions