Euler 1-5

This commit is contained in:
Jos van Goor 2022-12-01 16:45:37 +01:00
parent 9cf858b860
commit 68a75987e2
6 changed files with 161 additions and 0 deletions

24
project_euler/problem5.cc Normal file
View file

@ -0,0 +1,24 @@
#include <cstdint>
#include <fmt/format.h>
int main()
{
for (std::int64_t value = 40; ; value += 20)
{
bool valid = true;
for (std::size_t divisor = 2; divisor <= 20; ++divisor)
{
if (value % divisor != 0)
{
valid = false;
break;
}
}
if (valid)
{
fmt::print("Result: {}\n", value);
return 0;
}
}
}