summaryrefslogtreecommitdiff
path: root/3754/CH3/EX3.36/3_36.sce
blob: b2b372b167791cbced47e79d1bb63982094cf94d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clear//

//Variables

V = 6.0                  //voltage (in volts)
C = 2.0                  //Capacity of battery (in Ampere-hour)
P = 1.2                  //Power rating (in watt)

//Calculation

R = V**2 / P             //Resistance (in ohm)
I = V/R                  //Current  (in Ampere)
t = C/I                  //time (in hour)

//Result

printf("\n Battery will last for  %0.3f  hours.",t)