#include<stdio.h> #include<stdlib.h> int main() { int T,n,; scanf("%d",&T); while(T--){ scanf("%d",&n); long long a[n],sum=0; a[0]=1; a[1]=2; for(int j=2;j<n;j++){ a[j]=a[j-1]+a[j-2]; } for(j=0;j<n;j++){ sum+=a[j]; } printf("%lld\n",sum); } } /* Main.c: In function 'main': Main.c:5:10: error: expected identifier or '(' before ';' token int T,n,; ^ Main.c:15:7: error: 'j' undeclared (first use in this function) for(j=0;j<n;j++){ ^ Main.c:15:7: note: each undeclared identifier is reported only once for each function it appears in */ |
Double click to view unformatted code.