This content has been marked as final. Show 1 reply
Hi Umair ,
I am not sure why you have created so many different variables. ( b , c , d )
If you want to show number of years in yyyy way ( example :- 2020) then set cnt to 2012 as for loop is starting with 2012.
declare a number(9) :=1000; cnt number := 0; begin for d in 2012..2099 loop if a > 2000 then exit; end if; dbms_output.put_line(a||' '||d); a :=a + a*10/100; cnt := cnt + 1; end loop; dbms_output.put_line( 'Number of years required to reach the goal are:- ' || to_number(cnt) ); end; /