Write a Scala program to check the largest number among three given integers
- برمجة سكالا
- 2021-09-23
- mhanasmh00489829403
الأجوبة
object scala_basic {
def test(x: Int, y: Int, z: Int): Int = {
List(x, y, z).max
}
def main(args: Array[String]): Unit = {
println("Result: " + test(1,2,3));
println("Result: " + test(1,3,2));
println("Result: " + test(1,1,1));
println("Result: " + test(1,2,2));
}
}
Sample Output:
Result: 3 Result: 3 Result: 1 Result: 2
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة