I'm pulling my hair out trying to understand why this isn't working, it runs without errors but something with my calculations isn't working out and I'm not able to figure out what. Also the for loop does not end. I have a textfield where the user enters a value, I convert it to an int, and then use that as the number of questions on a quiz. in the loop i display the number of questions wrong from 1 wrong all the way to the number in the text field and next to it a score. The score results in 0 no matter what :\
calculation for a score is number of questions correct / number of questions * 100.
calculation for a score is number of questions correct / number of questions * 100.
Code:
- (IBAction)buttonTouched:(id)sender {
int myValue = (int) myTextField.text; //convert myTextField to an int
NSLog(@"Wrong Score");
for (int i = 1; i <= myValue; i++) {
NSLog(@"%d %d", i, (myValue - i) / (myValue) * 100);
}
[myTextField resignFirstResponder];
}