Answer to Question #41710 in C# for fahmida

Question #41710
accept ten numbers from the user and display following output
5
4
9
11
16
5
8
10
12
17
3 and also display their sum .. average ,largest number ,and smallest number by using for loop and counter variable
1
Expert's answer
2014-05-05T14:20:50-0400
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;

namespaceConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[10];

Console.WriteLine("Input tennumbers:");

for (int i = 0; i < 10; i++)
numbers[i] =int.Parse(Console.ReadLine());

Console.WriteLine("Output:");

for (int i = 0; i < 10; i++)
Console.WriteLine("{0}", numbers[i]);

Console.WriteLine("Sum:{0}", numbers.Sum());
Console.WriteLine("Average:{0}", numbers.Average());
Console.WriteLine("Min:{0}", numbers.Min());
Console.WriteLine("Max: {0}",numbers.Max());

Console.ReadLine();
}
}
}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS