#用for 循环for i in range(1,10): #print(i) # print(i*‘*‘) for j in range(1,i+1): print(‘%d * %d = %d‘%(j,i,i*j),end=‘ ‘) print(‘\n‘) #用while 循环
i = 1while i <= 9: j = 1 # print(i) while j <= i: # print(j) print(‘%d * %d = %d ‘ %(j,i ,i*j),end=‘ ‘) j = j + 1 print(‘\n‘) i = i +1
原文地址:https://www.cnblogs.com/snailrunning/p/8447034.html
时间: 2024-10-08 14:30:03