Write a PHP program to check if one given temperatures is less than 0 and the other is greater than 100

  • برمجة بي اتش بي

Write a PHP program to check if one given temperatures is less than 0 and the other is greater than 100

الأجوبة

<?php
function test($temp1, $temp2) 
{
   return $temp1 < 0 && $temp2 > 100 || $temp2 < 0 && $temp1 > 100;
}

var_dump(test(120, -1));
var_dump(test(-1, 120));
var_dump(test(2, 120));

Sample Output:

bool(true)
bool(true)
bool(false)
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...