I have created an accreditation system where a user can take exams. On marking the exam i wish to return a percentage figure. So i am taking the correct questions figure, dividing it by the number of questions in the exam and multiplying it by 100.
My issue is rounding the number up. So if the figure returned was 76.9 my code is giving me 76 where rounded up it should be 77 etc.
this is the line of code i that is working this out...
int userScorePercentageConvert = (int)decimal.Round((correctQuestionsForAttempt.Count / dvAttemptQuestions.Count * 100), MidpointRounding.AwayFromZero);
Can anyone tell me how to amend this piece of code so it is rounding correctly
i.e. 43.4 = 44 | 67.7 = 68 | 21.5 = 22
Many thanks in advance.