write program on Fibonacci numbers for 1 to n in C
manikanta veerla
6mo
int main()
{
int n;
scanf("%d",&n);
int a=0,b=1;
printf("%d %d ",a,b);
int count =0;
while(count less than n-2)
{
int sum=a+b;
a=b;
b=sum;
if(sum>n)
break;
count++;
printf("%d ",sum);
}
return 0;
}
Help your peers!
Add answer anonymously...
Top Efftronics Systems firmwa interview questions & answers
Top HR questions asked in Efftronics Systems firmwa
>
Efftronics Systems firmwa Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app