Project Euler にチャレンジ:Problem 2 C言語での解答

← Problem 1  Problem 3 →
#include<stdio.h>

int main(void)
{
	int i1 = 1 ; 
	int i2 = 2 ;
	int tmp = 0 ;
	int answer = 2;
	while(tmp < 4000000)
	{
		tmp = i1 + i2;
		if(tmp % 2 == 0)
		{
			answer += tmp;
		}
		i1 = i2;
		i2 = tmp;
	}
	printf("%d",answer); 
}
問題文