Arithmetic/Geometric  For/Loop
Author 
Message 
hobag

Posted: Wed Feb 21, 2018 7:21 pm Post subject: Arithmetic/Geometric  For/Loop 


Can someone help me? i have a crucial assignment for class and my teacher can't help me/explain. Its about adding, and listing arithmetic and geometric sequences.
If you guys could help that would be awesome.
3 Questions;
b.) Using a for structure, determine the next 5 terms;
4, 6, 9, 13.5, _, _, _, _, _
c.) Using a for structure, find the sum;
17 14 11 _, _, _, _, _
d.) Using a loop structure, find the sum;
3  6 +12  24 + ...49152  98304
im really new to this.
[/b]






Sponsor Sponsor



Srlancelot39

Posted: Thu Feb 22, 2018 9:57 am Post subject: Re: Arithmetic/Geometric  For/Loop 


What have you tried so far? I doubt your teacher would give you this assignment without first teaching how to use for and loop, and if they haven't for whatever reason, there's lots of existing resources and tutorials.
In all three questions, the numbers increment by a calculable amount (plus a small twist for b and d) making a for statement an ideal solution. Do something inside the loop that keeps track of the calculated numbers/sums.






hobag

Posted: Thu Feb 22, 2018 5:51 pm Post subject: RE:Arithmetic/Geometric  For/Loop 


i figured out question c). (i think)
but how do i do add AND subtract for geometric sequences?






Srlancelot39

Posted: Thu Feb 22, 2018 10:16 pm Post subject: RE:Arithmetic/Geometric  For/Loop 


Subtraction is really just addition of negative numbers...
There's an operation that can be performed every time to make every other number negative.







