Write a Scala program to create a new string which is n (non-negative integer ) copies of a given string
- برمجة سكالا
- 2021-09-23
- mhanasmh00489829403
الأجوبة
object scala_basic {
def test(str1: String, n: Int): String = {
str1 * n;
}
def main(args: Array[String]): Unit = {
println("Result: " + test("Scala", 2));
println("Result: " + test("Python",1));
println("Result: " + test("JS",6));
}
}
Sample Output:
Result: ScalaScala Result: Python Result: JSJSJSJSJSJS
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة