v = int(input('请输入一个整数:')) if v % 3 == 0 and v % 5 ==0: print(v,'即是3的倍数又是5的倍数') else: print('不是3或5的倍数') 原文地址:https://www.cnblogs.com/chengxubo/p/9902302.html
a = 0 count = 0 sz = [] num = 0 while a < 100: a += 1 if a%7 == 0: sz.append(a) count += 1 print("7的倍数是:",a) for i in range(len(sz)): num += sz[i] print("100以内有%s个奇数,所有奇数的和是%s"%(count,num)) 输出结果: 7的倍数是: 77的倍数是: 147的倍数是: 217的倍数是: 287