闲来无事,写着玩:
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")
}
}