#include <stdio.h> #define N 100 int main() { int M; long long int temp; while(scanf("%d", &M) != EOF && M != 0) { long long int sum = 0; long long int a = 0, b = 1; for(int i = 1; i <= M; i++) { sum = a + b; temp = a; a = b; b = temp + b; } printf("%lld\n", sum); } return 0; } |
Double click to view unformatted code.