what is the code of the output of print the 10 fibonacci
number series

Answers were Sorted based on User's Feedback



what is the code of the output of print the 10 fibonacci number series..

Answer / arun asokan

#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,limit=8;
clrscr();
printf("%d\t%d",a,b);
for(n=1;n<=limit;n++)
{
c=a+b;
a=b;
b=c;
printf("\t%d",c);
}
getch();
}

Is This Answer Correct ?    4 Yes 0 No

what is the code of the output of print the 10 fibonacci number series..

Answer / prassatharun

#include<stdio.h>
void main()
{
int a=0,b=1,c,limit=10,n=1;
clrscr();

printf("%d\n%d",a,b);
while(n<=limit)
{
c=a+b;
a=b;
b=c;
printf("\n%d",c);
n++;
}
getch();
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Code Interview Questions

Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }

1 Answers  


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4

2 Answers   HCL,


Is the following code legal? struct a { int x; struct a *b; }

2 Answers  


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  






main() { int i=400,j=300; printf("%d..%d"); }

3 Answers  


There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

1 Answers  


what is variable length argument list?

2 Answers  


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


how to swap 3 nos without using temporary variable

4 Answers   Satyam,


write a origram swaoing valu without 3rd variable

2 Answers  


program to find magic aquare using array

4 Answers   HCL,


Categories