1 Attachment(s)

Help with comparing answer to math problem and user's answer

Hi, I have to write a program where I give the user "p" random math problems, they decide how many by inputting p. I wrote the program using a for loop that gives them as many problems as they ask for, and ask them to input an answer for each one.

The problem is I need to be able to write a code that calculates how many they got right and then gives a percentage. I have no idea how to do this and any pointers would be greatly appreciated. I calculate the answer to each problem as float "answer" and the user answer for each problem is float "user".

here is my code so far:

Attachment 11759