views:

90

answers:

1

I try to calculate a miles per hours. For this I write a code like this

mint=sec/60;
hour=mint/60;
mph=miles/hour;
nsstring *speed=[nsstring stringwithformat:@"%5.2f",mph];

[mph settext: speed];

I get a miles from this code

miles = (steps *steplength)/1500;
NSString *distance =[NSString stringWithFormat:@"%5.3f",TotalDistance];
[Miles1 setText:distance];

And the error is shown me like this

miles per hour ans is (inf)

help me out

+1  A: 

If the minute count is < 60, then hour will be zero (if that's an integer division) and mph becomes inf.

Mau
thanks for u r answer
Pradeep