-->
当前位置:首页 > 题库 > 正文内容

单选题:h0005. 编写一个过程countdown(n:Int),打印从n到0的数字?

Luz3年前 (2022-03-13)题库502
编写一个过程countdown(n:Int),打印从n到0的数字?



A.
def countdown(n:Int){
0 to n foreach print
}
B.
def countdown(n:Int){
(0 until n).reverse foreach print
}
C.
def countdown(n:Int){
(0 to n).reverse foreach print
}
D.
def countdown(n:Int){
(0 to n-1).reverse foreach print
}


答案:C

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。