I am trying to write the syntax to add up ten user-inputted numbers in a Console application, and then divide the final product by 10 in order to get the average number. So far I am able to allow the user to input the numbers properly, and I have the program set up to allow the user time to read the result, however I am slightly stuck on the syntax to add up the numbers overall. I know this is very simple, but the operation for creating this code is escaping me. I have tried finding the answer online already, but so far my only results have been overly-complex or just downright wrong.
Any and all help would be greatly appreciated.
There are lots of ways to acheive this, but the easiest is to just keep a running total. You’ll need to cast the string input as a double using the double.Parse() method.
runningTotal = runningTotal + double.Parse(Console.ReadLine())After the last input, simply divide
runningTotalby 10 to display the result.