how to make a variable to be increasing and decreasing by a specified percentage

Status
Not open for further replies.

shegmite

Member level 1
Joined
Apr 8, 2012
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,496
I need syntax to make z to be increasing and decreasing by 10% over 20 sections as inputs and display 20 outputs as shown below :That is first section z = 220(10% increase) , second section = 198 (10% decrease) and so on.
f = 100;
z = 200 ;% how to make it to be increasing and decreasing by 10% each over 20 sections
b = 2; c = 4;
Y = f*b*c*z;
disp(Y);
 
Last edited:

You mean like this?

And, by the way, if you decrease 220 by 10%, you get 198, not 180.

Code:
z=200;
for i=0 to 19
         if i/2=int(i/2) then  //even
              z=z*1.1
         else
              z=z*.9
         end if;
         disp(z);
next i;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…