Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Console.Write("Type out the numbers with Spaces in between\r\nNumbers: ");
- string[] Numbers = Console.ReadLine().Split(' ');
- decimal[] AverageList = new decimal[Numbers.Length];
- for (int i = 0; i < AverageList.Length; i++)
- {
- AverageList[i] = decimal.Parse(Numbers[i]);
- }
- Console.WriteLine("Your Average is {0}\r\nPress any key to exit...", GetAverage(AverageList));
- Console.ReadKey(true);
- }
- static decimal GetAverage(decimal[] Average)
- {
- decimal d = 0.00M;
- foreach (decimal dec in Average)
- {
- d += dec;
- }
- d = d / Average.Length;
- return d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement