summaryrefslogtreecommitdiff
path: root/002.c
blob: 7a16a80497c0cb57a1ff6836df080276f094cc6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int main()
{
	int previous = 1, next = 2;
	int sum = 0, tmp = 0;

	while(next <= 4000000)
	{
		if(!(next & 1))
			sum += next;

		tmp = next;
		next += previous;
		previous = tmp;
	}

	printf("%ld\n", sum);

	return 0;
}