Python代码:统计区间内满足条件的整数
m, n = map(int, input('输入整数m,n:').split(','))
count = 0 for i in range(m, n+1): if i % 3 == 2 and '6' in str(i): count += 1
print(f'{m},{n}上除3余2且含6的整数共有{count}个')
原文地址: https://www.cveoy.top/t/topic/nE1s 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
m, n = map(int, input('输入整数m,n:').split(','))
count = 0 for i in range(m, n+1): if i % 3 == 2 and '6' in str(i): count += 1
print(f'{m},{n}上除3余2且含6的整数共有{count}个')
原文地址: https://www.cveoy.top/t/topic/nE1s 著作权归作者所有。请勿转载和采集!