5的倍數和7的倍數

 avatar
user_3763047219
c_cpp
2 years ago
272 B
2
Indexable
Never
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);
}