Write a PHP program to compute the sum of the two given integers. If one of the given integer value is in the range 10..20 inclusive return 18
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
function test($x, $y)
{
return ($x >= 10 && $x <= 20) || ($y >= 10 && $y <= 20) ? 18 : $x + $y;
}
echo test(3, 7)."\n";
echo test(10, 11)."\n";
echo test(10, 20)."\n";
echo test(21, 220)."\n";
Sample Output:
10 18 18 241
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال