- (IBAction)calciAction:(id)sender {
weightBMI=(([_weightinpounds.text floatValue]) * 4.88)/((([_feet.text floatValue])+ ([_inch.text floatValue]/12)) *(([_feet.text floatValue])+ ([_inch.text floatValue]/12)));
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterDecimalStyle;
formatter.maximumFractionDigits = 2;
formatter.roundingMode = NSNumberFormatterRoundUp;
NSString *numberString = [formatter stringFromNumber:@(weightBMI)];
NSLog(@"YOUR BMI:%@",numberString);
// NSLog(@"Print BMI %f",weightBMI);
// float height = (([_feet.text floatValue]) + ([_inch.text floatValue]));
if (weightBMI>19) {
NSLog(@"low weight");
}
else if ((weightBMI<=19)||(weightBMI>=24))
{
NSLog(@"low normal");
}
else if ((weightBMI<=25)||(weightBMI>=29))
{
NSLog(@"over weight");
}
}
how to write in else if block which is not printed properly
It often helps if you add "plain language" comments to your code. I'm assuming this is what you want to test: