Euler 1-5
This commit is contained in:
parent
9cf858b860
commit
68a75987e2
6 changed files with 161 additions and 0 deletions
15
project_euler/problem1.cc
Normal file
15
project_euler/problem1.cc
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <cstdint>
|
||||
#include <fmt/format.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::int64_t result = 0;
|
||||
|
||||
for (std::int64_t value = 3; value < 1000; value += 3)
|
||||
result += value;
|
||||
|
||||
for (std::int64_t value = 5; value < 1000; value += 5)
|
||||
result += value % 3 == 0 ? 0 : value;
|
||||
|
||||
fmt::print("Result: {}\n", result);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue