blob: 70445addf83b61a6dddd447b0a5f4de5181be16b (
plain)
1
2
3
4
5
6
7
8
|
//Example 7.12
P=0.200;//Power rating (kW)
t=6*30;//Duration of use; 6hours per day*30days (h)
E=P*t;//Energy consumed (kWh)
cost=E*0.120;//Cost per month, if cost of electricity is $0.120/kWh
printf('Cost of running the computer for the given duration = $%0.2f per month',cost)
//Openstax - College Physics
//Download for free at http://cnx.org/content/col11406/latest
|