首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

(Problem 二)Even Fibonacci numbers

2013-11-19 
(Problem 2)Even Fibonacci numbers#include stdio.h#include string.h#include ctype.h#include m

(Problem 2)Even Fibonacci numbers
#include <stdio.h>#include <string.h>#include <ctype.h>#include <math.h> #define N 4000000 int a[1001]; void solve(){ int a,b,c,n,count=2; a=1,c=0,b=2; n=3; while(c<=N) { c=a+b; if(n%2!=0) { a=c; } else { b=c; } n++; if(c%2==0) { count+=c; } } printf("%d",count);} int main(){ solve(); getchar(); getchar(); return 0;}

?

Answer:4613732

热点排行