Download presentation

Presentation is loading. Please wait.

Published byJewel Estey Modified about 1 year ago

1
There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. 1) 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. 1) For … Next 2) While.. Wend

2
1) 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

3
1) 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

4
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.

5
10 Key Off 15 print “Current = Voltage / resistance “ 20 for r = 1 to 5 30 let v=5 40 Let I = v / r 50 print I ; “=“ ; v ; “/” ; r 60 next 70 end 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

6
Current Voltage Resistance ===================================

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google