+ 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; }
4 odpowiedzi
+ 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;
}
+ 8
guy i dont know... sorry
+ 7
good
+ 6
fiif