5的倍數和7的倍數
user_3763047219
c_cpp
3 years ago
272 B
10
Indexable
int main()
{
int N = 0,count=0;
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
if (i % 5 == 0) {
count = count;
}
else if (i % 7 == 0 || i % 10 == 7) {
count = count + 2 * i;
}
else {
count = count + i;
}
}
printf("%d", count);
}Editor is loading...