Home > database >  O great god answer
O great god answer

Time:09-23

Deposit rates: example: someone at the bank deposit 5000 yuan, according to the annual rate of 5%, the sum of principal and interest can be up to 10000 yuan after how many years?
Calculation of principal and interest and formula: a=P (1 + r)?
(p for principal, interest, r is n is deposit number, for the principal and interest and a) requires the use of circular structure,

CodePudding user response:

DECLARE @ p=5000.00
MoneyDECLARE @ r Money=0.05
DECLARE @ a Money=5000.00
DECLARE @ n int=0

While @ a & lt; 10000.00
The BEGIN
The SET @ a *=(1 + @ r);
The SET @ n +=1
END
Print 'Total Year:' + Convert (Varchar (10), between (@ n))
  • Related