Firstly, don’t get people on the Internet to do your home work. Secondly, your else statement has no braces so you will always execute the last line which could lead to bugs. Here it won’t because you always want to execute the last line so you should remove it from all of your branches and just leave it at the end.


That same advice was given to him in a previous thread
Add all the raises together, then divide by the total number of employees.
First give your variables proper names. I can’t be bothered to read through in detail to figure out what is what. Secondly just add each result to a list and at the end do var average = list.Sum() / list.Count. Also you only need to do the sum after the if, which you are accidentally doing anyway.
C# devs
null reference exceptions

source