Math loops and the fibonacci sequence
in
Programming Questions
•
1 year ago
So i am very new to processing and programing and my cousin is an expert, he has been giving me simple problems for me to solve and improve my knowledge in these areas. The most recent work he wants to see is a line print of the Fibonacci sequence, at least the first 50 numbers. As you can see what i have is very tedious and ugly. I know there has to be some way to loop the sequence without labeling everything. I don't really know how to ask but if anyone understands what I'm trying to do feedback would be much appreciated. Thank you!
- int a = 0;
int b = 1;
int c = 1;
int d = b+c;
int e = c+d;
int f = d+e;
int g = e+f;
int h = f+g;
int i = g+h;
int j = h+i;
int k = i+j;
int l = j+k;
int m = k+l;
println (c= int( a+b ));
println (d= int( b+c ));
println (e= int( c+d ));
println (f= int( d+e ));
println (g= int( e+f ));
println (h= int( f+g ));
println (i= int( g+h ));
println (j= int( h+i ));
println (k= int( i+j ));
println (l= int( j+k ));
println (m= int( k+l ));
1