View Code of Problem 60

#include<stdio.h>
int main()
{
	 a[100],n,m,i,temp = 1;
	a[1] = 2;
	a[2] = 3;
	scanf("%d",&n);
	while(n>0)
	{
		scanf("%d",&m);
		for(i=3;i<=m;i++)
		{
			a[i] = a[i-1] + a[i-2];
		}
		printf("Scenario #%d:\n%d\n\n",temp++,a[m]);
		/*printf("Scenario #%d:\n%d\n\n",temp,a[m]);
		temp++;*/
		n--;
	}
}
/*
Main.c: In function 'main':
Main.c:4:3: error: 'a' undeclared (first use in this function)
   a[100],n,m,i,temp = 1;
   ^
Main.c:4:3: note: each undeclared identifier is reported only once for each function it appears in
Main.c:4:10: error: 'n' undeclared (first use in this function)
   a[100],n,m,i,temp = 1;
          ^
Main.c:4:9: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   a[100],n,m,i,temp = 1;
         ^
Main.c:4:12: error: 'm' undeclared (first use in this function)
   a[100],n,m,i,temp = 1;
            ^
Main.c:4:11: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   a[100],n,m,i,temp = 1;
           ^
Main.c:4:14: error: 'i' undeclared (first use in this function)
   a[100],n,m,i,temp = 1;
              ^
Main.c:4:13: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   a[100],n,m,i,temp = 1;
             ^
Main.c:4:16: error: 'temp' undeclared (first use in this function)
   a[100],n,m,i,temp = 1;
                ^
Main.c:4:15: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   a[100],n,m,i,temp = 1;
               ^
*/

Double click to view unformatted code.


Back to problem 60