DEV Community

Spikey sanju
Spikey sanju

Posted on

Solving Project Euler Problem Everyday - Day 01

Find the sum of all the multiples of 3 or 5 below 1000.

I have used kotlin for this problem.

Top comments (3)

Collapse
 
mendoza profile image
David Mendoza (He/Him)

made a quick c++ solution

#include<iostream>

int main() {
  int total = 0;
  for (int i = 0; i < 1000; i++) {
    if (i % 3 == 0 || i % 5 == 0)
      total += i;
  }
  std::cout << total << std::endl;
  return 0;
}

Collapse
 
spikeysanju profile image
Spikey sanju

That's great πŸ‘

Collapse
 
devwaseem profile image
Waseem akram • Edited

Python implementation :)

print(sum([i for i in range(1,1000) if i % 3 ==0 or i % 5 == 0]))