Created
August 30, 2012 00:08
-
-
Save MZAWeb/3520778 to your computer and use it in GitHub Desktop.
Eurler 2 (not tested)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unsigned int dd_eurler_2(){ | |
| int a = 1; | |
| int b = 2; | |
| int sum = 0, response = 0; | |
| for ( int i=0; a<4000000; i++ ) { | |
| sum = a + b; | |
| a = b; | |
| b = sum; | |
| if ( a % 2 == 0 ){ | |
| response+=a; | |
| } | |
| } | |
| return response; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $a = 1; | |
| $b = 2; | |
| $sum = 0; | |
| $response = 0; | |
| for ( $i=0; $a<4000000; $i++ ) { | |
| $sum = $a + $b; | |
| $a = $b; | |
| $b = $sum; | |
| if ( $a % 2 == 0 ){ | |
| $response+=$a; | |
| } | |
| } | |
| echo $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment