Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

shegmite

Member level 1
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top