Presentation is loading. Please wait.

# Control Structure There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. Iteration/Loop.

## Presentation on theme: "Control Structure There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. Iteration/Loop."— Presentation transcript:

Control Structure There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. Iteration/Loop The Loop mean one or more statements execute many times is called Loop. Here control transfer always upward. There are two types of loops. For … Next While .. Wend

Control Structure For .. Next
The for next loop allows programs to repeat a statement or statements, as long as a certain is number of times. Syntax For Variable = Start No. To Stop No. [ Step Increment No.] statement1 statement2 .. Next

Control Structure While .. Wend
The while loop allows programs to repeat a statement or series of statement, over and over, as long as a certain test condition is true. Syntax While test statement1 statement2 .. Wend

Practical #15 Write a program to calculate current value at five different resistance values are from 1 to 5 here constant voltage is 5 by using loops. Formula is I=V/R.

15 print “Current = Voltage / resistance “ 20 for r = 1 to 5
10 Key Off 15 print “Current = Voltage / resistance “ 20 for r = 1 to 5 30 let v=5 Let I = v / r print I ; “=“ ; v ; “/” ; r 60 next 70 end Out Put 10 CLS 20 Print “Current = Voltage / resistance “ 30 r=1 40 While r <= 5 50 let v=5 60 Let I = v / r 70 Print I ; “=“ ; v ; “/” ; r 80 r=r+1 90 Wend 100 End

Out Put Current Voltage Resistance ===================================

Download ppt "Control Structure There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. Iteration/Loop."

Similar presentations

Ads by Google