blob: 9931be8e4147176d55b4ff4bc1c4227aae16c058 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
//Chapter 1, Example 1.1
clc
//Initialisation
v1=15.8 //voltage
v2=12.3 //voltage
r=220 //resistance in ohm
//Calculation
v=v1-v2 //voltage
i=v/r //current in ampere
//Results
printf("Current, I = %.1f mA",(i*1000))
|