blob: fd73e176f16958681b24eac49390e9823307de4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//Chapter 3, Example 3.6
clc
//Initialisation'
v1=5 //voltage
i=2 //current in ampere
r1=10 //resistance in ohm
r2=5 //resistance in ohm
//Calculation
i1=v1/(r1+r2) //current in ampere
r=(r1*r2)/(r1+r2) //resistance in ohm
v=i*r //voltage
i2=v/r2 //current in ampere
i3=i1+i2 //current in ampere
//Results
printf("Current, I = %.2f A",i3)
|