-
Notifications
You must be signed in to change notification settings - Fork 2
/
capacitors-in-series-or-parallel.bas
65 lines (65 loc) · 1.42 KB
/
capacitors-in-series-or-parallel.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
100 REM THIS IS PROGRAM NO. 25 PROG25
110 REM IT WILL CALCULATE THE VALUES OF
120 REM N CAPICITORS IN SERIES OR
125 REM PARALLEL.
130 DIM C(1000)
150 GSUM = 0
160 CSUM = 0
170 GOSUB 550
180 PRINT "HOW MANY CAPACITORS ARE THERE???"
190 INPUT N
205 GOSUB 550
210 FOR I = 1 TO N
220 C(I) = 0
230 NEXT I
240 FOR I = 1 TO N
250 PRINT "ENTER C(";I;"): "
260 INPUT C(I)
270 G(I) = 1/C(I)
280 GSUM = GSUM + G(I)
290 CSUM = CSUM + C(I)
300 NEXT I
310 GOSUB 550
320 CTP = 1/GSUM
330 PRINT "PARALLEL OR SERIES???"
340 PRINT TAB(5);"1. PARALLEL"
350 PRINT TAB(5);"2. SERIES"
360 PRINT TAB(5);"3. BOTH SERIES & PARALLEL"
370 PRINT
380 PRINT "SELECT ONE FROM ABOVE..."
390 INPUT D
400 IF D > 3 THEN GOTO 330
410 ON D GOTO 470,440,500
440 GOSUB 550
450 PRINT "SERIES TOTAL OF ";N;" CAPACITORS: ";CTP;" UF"
460 GOTO 590
470 GOSUB 550
480 PRINT "PARALLEL TOTAL OF ";N;" CAPACITORS: ";CSUM;" UF";
490 GOTO 590
500 GOSUB 550
510 PRINT "TOTAL PARALLEL CAPACITANCE: ";CSUM;" UF"
520 PRINT
530 PRINT "TOTAL SERIES CAPACITANCE: ";CTP;" UF"
540 GOTO 590
550 FOR I = 1 TO 30
560 PRINT
570 NEXT I
580 RETURN
590 PRINT
600 PRINT "PRESS CR TO CONTINUE..."
610 INPUT KK
620 GOSUB 550
630 PRINT "FINISHED (Y/N)????"
640 PRINT TAB(5);"1. YES"
650 PRINT TAB(5);"2. NO"
660 PRINT
670 PRINT "SELECT ONE FROM ABOVE AND"
675 PRINT "PRESS CR....."
680 INPUT F
690 IF F > 2 THEN GOTO 630
700 IF F = 2 THEN GOTO 150
710 GOSUB 550
720 PRINT "PROGRAM ENDED....."
730 PRINT
740 PRINT
750 END