Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
405 B
7
Indexable
Never
<?php

$numbers = explode(' ', readline("enter list of numbers : "));

$max = $numbers[0];

$min = $numbers[0];

for($i = 0; $i < sizeof($numbers); $i++){
    
    if($numbers[$i]  >= $max){
        
        $max = $numbers[$i];

    }elseif($numbers[$i] <= $min){
        
        $min = $numbers[$i];
        
    }


}

echo "your maximum is {$max}" . PHP_EOL;

echo "your minimum is {$min}" . PHP_EOL;