Tuesday, 22 November 2011

Time value of money -Chess borad calculation

------- By Shrikesh
DECLARE
vs NUMBER:=100;
gs NUMBER:=0;
BEGIN
dbms_output.put_line('This is the chess board method for investment.
                           In which each cell is double of previous one ');
FOR i in 1..64
LOOP
gs:=gs+vs;
dbms_output.put_line('Investment for month '||i||' Amount -> '||vs||' Total Sum till '||gs);
vs:=vs*2;

IF i/12 in (1,2,3,4,5) then
dbms_output.put_line('Year '||i/12||' Completed and average on toal sum '||gs/i);
END IF;
END LOOP;
EXCEPTION
WHEN others then
dbms_output.put_line('Error :'||SQLERRM||SQLCODE);
END;

No comments:

Post a Comment