Blame view

2.py 293 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python

import sys;

fibonacci1 = 1;
fibonacci2 = 2;
fibonacci = 0;
sum = 2;
while(fibonacci < int(sys.argv[1])):
	fibonacci = fibonacci1 + fibonacci2;
	if((fibonacci % 2) == 0):
		sum += fibonacci;
	fibonacci1 = fibonacci2;
	fibonacci2 = fibonacci;

print "Result is: " + str(sum);