blob: 6956c8edee833c67d9f8229fb475aeb34dda2ef5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
clear//
//Variables
R2 = 100 //Resistance R2 (in ohm)
I = 0.3 //Current (in Ampere)
VT = 120 //Voltage (in volts)
//Calculation
RT = VT / I //Total Resistance (in ohm)
R1 = RT - R2 //Resistance R1 (in ohm)
P1 = I**2 * R1 //Power dissipated by R1 (in watt)
P2 = I**2 * R2 //Power dissipated by R2 (in watt)
//Result
printf("\n The power dissipated by R1 is %0.3f W.\nThe power dissipated by R2 is %0.3f W.",P1,P2)
|