blob: 60ab9ceba7b17c88c3b115b8a1caab59c7332e61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
clear//
//Variables
VS = 6 //Source voltage (in volts)
R1 = 330 //Resistance (in ohm)
R2 = 470 //Resistance (in ohm)
VD = 0.7 //Diode voltage (in volts)
//Calculation
RT = R1 + R2 //Total Resistance (in ohm)
I = (VS - 0.7)/RT //Current through the diode
//Result
printf("\n Current through the circuit is %0.3f mA.",I * 10**3)
|