summaryrefslogtreecommitdiff
path: root/3754/CH12/EX12.12/12_12.sce
diff options
context:
space:
mode:
Diffstat (limited to '3754/CH12/EX12.12/12_12.sce')
-rw-r--r--3754/CH12/EX12.12/12_12.sce16
1 files changed, 16 insertions, 0 deletions
diff --git a/3754/CH12/EX12.12/12_12.sce b/3754/CH12/EX12.12/12_12.sce
new file mode 100644
index 000000000..0e2b05b21
--- /dev/null
+++ b/3754/CH12/EX12.12/12_12.sce
@@ -0,0 +1,16 @@
+clear//
+
+//Variables
+
+VS = 5 //Source voltage (in volts)
+R = 510 //Resistance (in ohm)
+VF = 0.7 //Forward voltage drop (in volts)
+
+//Calculation
+
+VR = VS - VF //Net voltage (in volts)
+I = VR / R //Current through the diode
+
+//Result
+
+printf("\n Voltage across the resistor is %0.3f V.\nThe circuit current is %0.2f mA.",VR,I*10**3)