10的阶乘
简单(loop)循环
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' simple';
5 begin
6 loop
7 s:=s*i;
8 i:=i+1;
9 dbms_output.put_line(s||''||name);
10 exit when i>10;
11 end loop;
12* end;
---------------------------------------------------可爱的分割线(脸红)--------------------------------------------------------
for循环
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' for';
5 begin
6 loop
7 s:=s*i;
8 i:=i+1;
9 dbms_output.put_line(s||''||name);
10 end loop;
11* end;
SQL> /
1 for
2 for
6 for
24 for
120 for
720 for
5040 for
40320 for
362880 for
3628800 for
---------------------------------------------------可爱的分割线(脸红)--------------------------------------------------------
while循环
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' while';
5 begin
6 while i /
1 while
2 while
6 while
24 while
120 while
720 while
5040 while
40320 while
362880 while
3628800 while
Oracle编写的1至100和的算法 用循环控制结构中至少三种循环方式计算10的阶乘
Oracle编写的1至100和的算法 用循环控制结构中至少三种循环方式计算10的阶乘
其他人气:769 ℃时间:2019-11-04 13:22:56
优质解答
我来回答
类似推荐
猜你喜欢
- 1己亥杂诗 赞美落花精神的句子.
- 2made to make a difference.
- 3最令人感动的句子
- 4These days students are doing less and less sports.They often say they have _1 more importa
- 5早上或傍晚的时候天空是红色,而在中午的时候天空是蓝色的
- 6do ask the teacher the question是什么意思
- 7借物喻人作文【写植物】300字以上
- 8甲、乙两班各有一个图书室,共有303本书.已知甲班图书的5/13和乙班图书的1/4合在一起是95本,那么甲班图书有_ 本.
- 9天气突变,下起了狂风暴雨.修改病句
- 10what is more和what's more是一样的吗