objective c - NSNumber giving wrong value -
i have these values int score = 7, answered = 40, skipped = 0, totalrecords = 2;
nsnumber *percentage =[nsnumber numberwithfloat:(score / (answered + skipped)) / totalrecords];
it returning 0.000 instead of 0.0875. problem
change initial value int float :
float score = 7.0, answered = 40.0, skipped = 0.0, totalrecords = 2.0;
Comments
Post a Comment