Задача2 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Задача2.php
- <?php
- $line = stream_get_line(STDIN, 1024, PHP_EOL);
- $d = explode(' ', $line);
- $m = [];
- $max;
- $min;
- for ($i=0; $i< count($d); $i++){
- if($i%2 || $i = 0)
- array_push ($m, $d[$i] );
- }
- for ($i=0; $i< count($m); $i++)
- {
- for ($j=$i+1; $j< count($m); $j++)
- {
- if ($m[$i] > $m[$j])
- $max = $m[$i];}
- }
- for ($i=0; $i< count($m); $i++)
- {
- for ($j=$i+1; $j< count($m); $j++)
- {
- if ($m[$i] < $m[$j]) {
- $min = $m[$i];}
- }
- for ($i=0; $i< count($m); $i++)
- {
- $sum = $sum + $m[$i];
- }
- echo $max;
- echo $min;
- echo $sum;
- }
- ?>
File Description
- Задача2
- PHP Code
- 31 Aug-2022
- 631 Bytes
You can Share it:
Latest PHP Pastes