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

Popular posts from this blog

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -