Første problemet i Project Euler. Ble egentlig bare lagt inn her for å teste ut om syntaxhighlighter fungerte som det skulle.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
public int Calculate(int num) { for (int i = 1; i < num; i++) { if (i % 3 == 0 || i % 5 == 0) sum += i; } return sum; }
Remember Me
a@href@title, b, em, i, strike, strong
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.