python
num = int(input("Enter an integer: "))
reversed_num = 0
while num!=0:
remainder = num % 10
reversed_num = reversed_num * 10 + remainder
num //=10
print("The reversed number is",reversed_num)
python
num = int(input("Enter an integer: "))
divisible_by_5_and_6 = (num % 5 == 0) and (num % 6 ==0)
divisible_by_5_or_6 = (num % 5 == 0) or (num % 6 ==0)
divisible_by_5_or_6_but_not_both= ((num % 5 == 0) and (num % 6!=0)) or ((num % 5!= 0) and (num % 6 == 0))
print(f"Is {num} divisible by 5 and 6? {divisible_by_5_and_6}")
print(f"Is {num} divisible by 5 or 6? {divisible_by_5_or_6}")
print(f"Is {num} divisible by 5 or 6, but not both? {divisible_by_5_or_6_but_not_both}")
python
# 左下三角形
print("模式A")
for i in range(6):
for j in range(6):
if j < i+1:
print(j+1, end=" ")
else:
print("", end=" ")
print()
print()
# 左上三角形
print("模式B")
for i in range(6):
for j in range(6):
if j < (6-i):
if j != (6-i-1):
print(j+1, end=" ")
else:
print(j+1, end=" ")
else:
print(" ", end=" ")
print()
print()
# 右下三角形
print("模式C")
for i in range(6):
for j in range(6):
if (i+j) >=5:
print(j+1-5+i, end=" ")
else:
print(" ", end=" ")
print()
print()
# 右上三角形
print("模式D")
for i in range(6):
for j in range(6):
if j >= i:
print(j+1-i, end=" ")
else:
print(" ", end=" ")
print()
print()