Ohm’s Law

Date: 198x
Type: Program
Platform(s): TS 2068

Calculates power, resistance or voltage from two known values.

Appears on

Library tape of the Indiana Sinclair Timex User’s Group.

Source Code

   10 REM //////////////////////
   20 REM /                    /
   30 REM /      OHM'S LAW     /
   40 REM /                    /
   50 REM //////////////////////
   60 PRINT "  OHM'S LAW  "
   70 CLS 
   80 LET v=0: LET i=v: LET r=i: LET p=r
   90 PRINT "Input known values"
  100 PRINT "  0 If unknown"
  120 PRINT '''"voltage     (V)=";
  130 INPUT V
  140 PRINT V;" V"
  150 PRINT ;"Current     (I)=";
  160 INPUT I
  170 PRINT I;" A"
  180 IF V AND I THEN GO TO 260
  190 PRINT ;"Resistance  (R)=";
  200 INPUT R
  210 PRINT R;" Ohms"
  220 IF V AND R OR I AND R THEN GO TO 260
  230 PRINT ;"Power       (P)=";
  240 INPUT P
  250 PRINT P;" W"
  260 IF NOT V OR NOT I THEN GO TO 290
  270 PRINT "Power        (P)=";V*I;" W"
  280 PRINT "Resistance   (R)=";V/I;" Ohms"
  290 IF NOT P OR NOT R THEN GO TO 320
  300 PRINT "Current      (I)=";SQR (P/R);" A"
  310 PRINT "Voltage      (V)=";SQR (P*R);" V"
  320 IF NOT P OR NOT I THEN GO TO 360
  330 PRINT "Voltage      (V)=";P/I;" V"
  340 PRINT "Resistance   (R)=";P/(I^2);" Ohms"
  350 REM ^ = raised to the power of
  360 IF NOT R OR NOT V THEN GO TO 390
  370 PRINT "Power        (P)=";(V^2)*R;" W"
  380 PRINT "Current      (I)=";V/R;" A"
  390 IF NOT I OR NOT R THEN GO TO 420
  400 PRINT "Power        (P)=";(I^2)*R;" W"
  410 PRINT "Voltage      (V)=";I*R;" V"
  420 IF NOT V OR NOT P THEN STOP 
  430 PRINT "Resistance   (R)=";(V^2)/P;" Ohms"
  440 PRINT "Current      (I)=";P/V;" A"
  445 STOP 
  450 SAVE "OHM'S LAW" LINE 1

People

No people associated with this content.

Scroll to Top