Write a PHP program to compute the sum of the three integers. If one of the values is 13 then do not count it and its right towards the sum
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
function test($x, $y, $z)
{
if ($x == 13) return 0;
if ($y == 13) return $x;
if ($z == 13) return $x + $y;
return $x + $y + $z;
}
echo (test(4, 5, 7))."\n";
echo (test(7, 4, 12))."\n";
echo (test(10, 13, 12))."\n";
echo (test(13, 12, 18))."\n";
Sample Output:
16 23 10 0
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال