lua学习之循环打印九九乘法表

 1 --第4题  输出99乘法表
 2 function PrintMulitiplyTable()
 3     for i = 1, 9 do
 4         local res = {}
 5         local str = ""
 6         for j = 1, i do
 7             res[j] = i * j
 8             str = table.concat(res, " ")
 9         end
10         print(str)
11     end
12 end
13 
14 PrintMulitiplyTable()

 

posted @ 2018-12-24 20:56  _清风明月  阅读(696)  评论(0编辑  收藏  举报