blob: 21f42aa8cdc2d199a04c03ead82b0fecb14259e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
clc
//given data
i=12/100.0 // interest rate
n=10 // time in years
time=100.0 // days geyser is used in year
effi=0.9 // efficiency of geyser
w=100.0 // weight of water in kg
C=4.2 // heat capacity in kJ/kg-degree C
theta=60-15 // temperature difference in C
cost=4 // cost of electricity per kWh
Elec=(1/effi)*w*C*theta/3600.0 // electricity used in kWh/day
A=Elec*time*cost // annual saving in Rs
P=A*(((1+i)**n)-1)/(i*((1+i)**n)) // final amount in rs
printf("The final amount after 10 years is Rs %i",P)
// the answer is slightly different in textbook due to approximation while in scilab answers are precise
|