#include <iostream> using namespace std; int sum(int day){ if(day == 1||day == 2||day == 3) return day; else return sum(day-1)+sum(day-2); } int main(){ int n; while(scanf("%d",&n)!=EOF%%n){ printf("%d\n",sum(n)); } } /* Main.cc: In function 'int main()': Main.cc:13:29: error: expected primary-expression before '%' token while(scanf("%d",&n)!=EOF%%n){ ^ */ |
Double click to view unformatted code.