#include <stdio.h>
int main() {
unsigned long long t = 1000000000;
unsigned long long c = 0;
while (t) {
if (!(t % 7)) ++c;
--t;
}
return c;
}
time ./a.out
real 0m1.151s
user 0m1.141s
sys 0m0.000s
-----------------------
Coliru Viewer
http://coliru.stacked-crooked.com/a/5c5b5d8ae75e7773
#include <iostream>
#include <chrono>
int main() {
constexpr unsigned maxNum { 1'000'000'000 };
unsigned cnt {};
const auto t_start { std::chrono::steady_clock::now() };
for (unsigned i {1}; i <= maxNum; ++i)
cnt += i % 7 == 0;
const auto t_end { std::chrono::steady_clock::now() };
std::cout << "Found " << cnt << " in " << std::chrono::duration_cast<std::chrono::milliseconds>(t_end - t_start).count() << " milliseconds\n";
}