Tryana find the febonaccy series, but the output goes too long! Anyone pls short out this query.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Tryana find the febonaccy series, but the output goes too long! Anyone pls short out this query....

#include <stdio.h> int main() { int i,a,b,c,cnt; a=0; b=1; //printf("\n %d%d",a,b); scanf("%d",&cnt); i=3; while(i<=cnt) { c=a+b; printf("\n %d",c); a=b; b=c; i=i++; } return 0; }

5th Feb 2018, 1:48 AM
<Saurabh Singh Rawat/>
<Saurabh Singh Rawat/> - avatar
4 Answers
+ 2
//hay, I got it now! in a different method ... wow!!! #include <stdio.h> int main() { int i,a,b,c,s,cnt; a=0; b=1; scanf("%d",&cnt); i=3; s=a+b; while(i<=cnt) { c=a+b; printf("\n %d",c); s=s+c; a=b; b=c; i++; } printf("\n sum=%d",s); return 0; }
5th Feb 2018, 1:55 AM
<Saurabh Singh Rawat/>
<Saurabh Singh Rawat/> - avatar
+ 8
guy i dont know... sorry
5th Feb 2018, 1:51 AM
AkIM ReZA
AkIM ReZA - avatar
+ 7
good
5th Feb 2018, 2:13 AM
AkIM ReZA
AkIM ReZA - avatar
+ 6
fiif
5th Feb 2018, 2:11 AM
AkIM ReZA
AkIM ReZA - avatar