summaryrefslogtreecommitdiff
path: root/3754/CH4/EX4.9/4_9.sce
blob: 3a0b7e829bcb9f4309142de95c704e0f94e6fe70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
clear//

//Variables

V = 10.0                 //Voltage (in volts)
R1 = 10**6               //Resistance (in ohm)
R2 = 10 * 10**3          //Resistance (in ohm)

//Case (a):

//Calculation

RT = R1 + R2             //Total Resistance (in ohm)
I = V / RT               //Current (in Ampere)

//Result

printf("\n Current through the circuit is  %0.3f  A.",I)

//Case (b):

//Calculation

RT = R1                  //Total Resistance (in ohm)
I = V / RT               //Current (in Ampere)

//Result

printf("\n Current through circuit when R2 is shortened is  %0.3f  A.",I)