calculate the percent

juggernot

Well-known member
Joined
Sep 28, 2006
Messages
173
Programming Experience
Beginner
does anyone know how i would calculate a score? I have 6 questions right now, and I was wanting it to calculate the percent you had right.
 
Percent = CorrectAnswers / TotalQuestions

plug in your variables in the correct spots and there ya go
 
When working with small floating point numbers, I normally do:

Percent = (CorrectAnswers * 100) / TotalQuestions

It avoids information loss caused by underflow


If working with very large numbers, I use vis' method - this time to help avoid overflow. In your case, either will suffice​
 
Back
Top