I am trying to make a simple objective-C height converter. The input is a (float) variable of feet, and I want to convert to (int) feet and (float) inches:
f
Even modulo works for float, use :
fmod()
You can use this way too...
float totalHeight = 5.122222; float myFeet = (int) totalHeight; //returns 5 feet float myInches = fmodf(totalHeight, myFeet); NSLog(@"%f",myInches);