一道算法题开户时存入1000元到账户。并在每年末加存1000元。如果利息是5%,那么至账户里有至少100万元时需要多长时间?用T-SQL实现。 [解决办法]
declare @year int=0,@money numeric(18,2)=1000while @money<1000000begin set @money=@money+@money*0.05+1000 set @year=@year+1endprint @year