Skip to content

Instantly share code, notes, and snippets.

@Getaji
Created November 20, 2013 13:36
Show Gist options
  • Save Getaji/7563282 to your computer and use it in GitHub Desktop.
Save Getaji/7563282 to your computer and use it in GitHub Desktop.
Problem 2 「偶数のフィボナッチ数」
import std.stdio;
int main(string[] argv) {
int ct, a = 1, b = 1, c = 1;
while(b <= 400_0000)
{
a = b+c;
b = c;
c = a;
if (b % 2 == 0) ct += b;
}
writeln(ct);
readln();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment