summaryrefslogtreecommitdiff
path: root/3835/CH2/EX2.1/Ex2_1.sce
blob: 8fd2f232d8ea70456d224345a65918f28ece2c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clear
//
v=10
r=4
//case a
i=v/(r)
printf("\n i= %0.1f  A",i)
//case b
//6ohm resistor is in series with 4 ohm resistor
i=v/(6+4)
v1=i*6
v2=i*4
printf("\n voltage across 6 ohm resistor= %0.1f  V",v1)
printf("\n voltage across 4 ohm resistor= %0.1f  V",v2)
//case c
i=10 //constant in both cases
v4=i*4
printf("\n voltage when 4 ohm resistor is connected= %0.1f  V",v4)
v6=i*6
v=v4+v6
printf("\n voltage when both resistors are in series= %0.1f  V",v)