blob: 77fab8003da9d8bf0085ece9a9181673cf0f2c7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
clear//
//Variables
R = 330 //Resistance (in ohm)
VS = 5 //Source voltage (in volts)
//Calculation
VD = VS //Voltage drop across diode (in volts)
VR = 0 //Voltage drop across the resistance (in volts)
I = 0 //Current through circuit
//Result
printf("\n Voltage drop across the diode is %0.3f V.\nVoltage drop across the resistance is %0.3f V.\nCurrent through the circuit is %0.3f A.",VD,VR,I)
|