Valor maximo y minimo de un arreglo de numeros (Float - Double))

float maximumPrice = -MAXFLOAT; float minimumPrice = MAXFLOAT; for (NSNumber *num in arrayPrices) { float x = num.floatValue; if (x < minimumPrice){minimumPrice = x;} if (x > maximumPrice){maximumPrice = x;} } NSLog(@"Minimum Price: %f", minimumPrice); NSLog(@"Maximum Price: %f", maximumPrice);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.