求1到100这100个自然数中,所有加4以后能被5整除的数之和是多少
2个回答
展开全部
970
符合条件的数字:
[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
import math
import numpy as np
a = []
for i in range(1,101):
if (i + 4) % 5 == 0:
print i
a.append(i)
print a
sum =0
for j in a:
sum +=j
print sum
[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
970
符合条件的数字:
[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
import math
import numpy as np
a = []
for i in range(1,101):
if (i + 4) % 5 == 0:
print i
a.append(i)
print a
sum =0
for j in a:
sum +=j
print sum
[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
970
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询