Math.round and just plain math

Math.round and just plain math

Post by aixamarque » Fri, 01 Jun 2007 08:13:16


Hi, I'm back with another question.

I want my exam to show a percentage at the end. I guess I'll concatenate a
'percent sign' at the end, but right now I'm having trouble with the math.

There are 13 questions. This is what I have:

score = Math.round(right/13*100);

The scores are coming out all wrong. Any ideas would be greatly appreciated.

Dan
 
 
 

Math.round and just plain math

Post by kgla » Fri, 01 Jun 2007 08:40:47

that code should work if you want to round to the nearest whole percent (and right is a number).