当前位置: 代码迷 >> Sql Server >> 一道算法题解决方案
  详细解决方案

一道算法题解决方案

热度:45   发布时间:2016-04-27 13:34:16.0
一道算法题
开户时存入1000元到账户。并在每年末加存1000元。如果利息是5%,那么至账户里有至少100万元时需要多长时间?



用T-SQL实现。 


------解决方案--------------------
SQL code
declare @year int=0,@money numeric(18,2)=1000while @money<1000000begin     set @[email protected][email protected]*0.05+1000     set @[email protected]+1endprint @year
  相关解决方案