Write a Scala program to check whether two given integer values are in the range 20..50 inclusive. Return true if 1 or other is in the said range otherwise false
- برمجة سكالا
- 2021-09-23
- mhanasmh00489829403
الأجوبة
object scala_basic {
def test(x: Int, y: Int): Boolean =
{
(x <= 20 || y >= 50) || (y <= 20 || x >= 50);
}
def main(args: Array[String]): Unit = {
println("Result: " + test(20, 84));
println("Result: " + test(14, 50));
println("Result: " + test(11, 45));
println("Result: " + test(25, 40));
}
}
Sample Output:
Result: true Result: true Result: true Result: false
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة