summaryrefslogtreecommitdiff
path: root/3754/CH12/EX12.12/12_12.sce
blob: 0e2b05b210eefa99805a975a7e845bc85f9c4cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)