实现代码
def main(args: Array[String]): Unit = {println("请输入两个数:")var a = StdIn.readInt()var n = StdIn.readInt()var sum = 0;var a2 = afor (i <- 0 to n-1 ){var num = math.pow(10,i).toIntif(i!=0){a2 += a*num}sum+=a2}println(sum)}
def main(args: Array[String]): Unit = {println("请输入两个数:")var a = StdIn.readInt()var n = StdIn.readInt()var sum = 0;var a2 = afor (i <- 0 to n-1 ){var num = math.pow(10,i).toIntif(i!=0){a2 += a*num}sum+=a2}println(sum)}