Commit 1eb090cf by BellCodeEditor

save project

parent 26f6097e
Showing with 19 additions and 6 deletions
for i in range(1,10): # for i in range(1,10):
for j in range(1,i+1): # for j in range(1,i+1):
# 使用变量i和j,代替乘法算式里面的元素,打印出单个乘法算式 # # 使用变量i和j,代替乘法算式里面的元素,打印出单个乘法算式
print(i,'*',j,'=',(j*i),end=" ") # print(i,'*',j,'=',(j*i),end=" ")
print() # print()
\ No newline at end of file
while True:
n=int(input("请输入一个数"))
x=1
if n<2:
x=0
print("这不是个合数,也不是个质数")
for i in range(2,n):
if n%i==0:
x=0
print("这是个合数")
break
if x==1:
print("这是个质数")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment