iOS开发之 -- oc和swift下输出乘法口诀表
闲来无事,写着玩:
oc:
//乘法口诀表输出 for (int i = 1; i<=9; i++) { for (int j = 1; j<=i; j++) { NSLog(@"%dx%d=%d\n",i,j,i*j); } }
swift:
//乘法口诀输入 for i in 1...9 { for j in 1...i { print("\(i)x\(j)=\(i*j)\n") } }
本文来自博客园,作者:稻草人11223,转载请注明原文链接:https://www.cnblogs.com/hero11223/p/6681021.html