本文共 641 字,大约阅读时间需要 2 分钟。
sql求阶乘
Here you will get pl/sql program to find factorial of a number.
在这里,您将获得pl / sql程序来查找数字的阶乘。
We can calculate factorial of a number by multiplying it with all the numbers below it.
我们可以通过将数字乘以其下所有数字来计算阶乘。
For example factorial of 5 = 5 x 4 x 3 x 2 x 1 = 120.
例如5的阶乘= 5 x 4 x 3 x 2 x 1 = 120。
declare n number; fac number:=1; i number; begin n:=&n; for i in 1..n loop fac:=fac*i; end loop; dbms_output.put_line('factorial='||fac);end;/
Output
输出量
Enter value for n: 10 old 7: n:=&n; new 7: n:=10; factorial=3628800
输入n的值:10 旧7:n:=&n; 新7:n:= 10; 阶乘= 3628800
翻译自:
sql求阶乘
转载地址:http://cgggb.baihongyu.com/