getting the actual sum as we shifted the numbers by 50 to avoid negative indexing in array
$ temp = $ i - 50 * $ n ; $ max_value = max ( $ max_value , $ temp * ( $ sum - $ temp ) ) ; $ min_value = min ( $ min_value , $ temp * ( $ sum - $ temp ) ) ; } } echo ( " Maximum ▁ Value : ▁ " . $ max_value . " " . ▁ " Minimum Value : " . ▁ $ min _ value . ▁ " " }