ios - Getting all decimals from interger being Squarooted -
the solution of square root of 11 in normal calculator
3.31662479036
i trying round 3.32
so problem having in ios is;
in viewdidload
int mynumber = sqrt(11); nslog(@"%d", mynumber);
i keep getting 3 when should first 3 integers. can me solve this?
int
integers, not decimals. use float
, %f
.
float mynumber = sqrtf(11); nslog(@"%.2f", mynumber);
Comments
Post a Comment