den andre siden av elven RSS 2.0
# Thursday, July 17, 2008

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.

public int Calculate(int num)
{
    for (int i = 1; i < num; i++)
    {
        if (i % 3 == 0 || i % 5 == 0)
            sum += i;
    }

    return sum;
}
17 July, 2008  #    Comments [1] -
Kode | Project Euler
Friday, July 18, 2008 7:25:34 AM (W. Europe Standard Time, UTC+01:00)
Takk for linken på msn :D Meget interessant, til tross for at jeg nesten strøyk første matte året på VGS :P Selv har jeg gitt meg dobbel utfordring ved å løse disse, jeg gjorde de to første i PHP, og følte meg slummete. Ikke at PHP ikke er bra nok, men til sitt bruk, men jeg fant ut at jeg kunne lære meg mer Python i stedet :P
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, em, i, strike, strong) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Navigation
Categories
Archive
<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Johan Grønstad
Sign In
Statistics
Total Posts: 7
This Year: 7
This Month: 0
This Week: 0
Comments: 5
Themes
Pick a theme:
All Content © 2008, Johan Grønstad
DasBlog theme 'Business' created by Christoph De Baene (delarou)