-
Notifications
You must be signed in to change notification settings - Fork 0
/
textpadloop.txt
78 lines (75 loc) · 1.49 KB
/
textpadloop.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
set serveroutput on
declare
v_recno number(4);
ctr_no number(2) := 0;
begin
while ctr_no < 6 loop
ctr_no := ctr_no + 1;
v_recno := ctr_no + ctr_no;
dbms_output.put_line(ctr_no||'+'|| ctr_no || '='|| v_recno );
end loop;
end;
/
set serveroutput off
set serveroutput on
declare
v_recno number(4) := 1;
ctr_no number(2) := 0;
total number(2) := 0;
begin
while v_recno <= 4 loop
for i in 1..4 loop
ctr_no := ctr_no + 1;
total := ctr_no + v_recno;
dbms_output.put_line(v_recno||'+'|| ctr_no || '='|| total );
end loop;
v_recno := v_recno + 1;
ctr_no := 0;
end loop;
end;
/
set serveroutput off
PROBLEM 4
set serveroutput on
declare
recno number(4) := 1;
ctr_no number(2) := 0;
total number(2) := 0;
begin
while recno <= 4 loop
while ctr_no < 4 loop
ctr_no := ctr_no + 1;
total := recno + ctr_no;
dbms_output.put_line(recno||'+'|| ctr_no || '='|| total );
end loop;
recno := recno + 1;
ctr_no := 0;
end loop;
end;
/
set serveroutput off
PROBLEM ##5
set serveroutput on
declare
recno number(4) := 1;
ctr_no number(2) := 0;
total number(2) := 0;
begin
loop
loop
ctr_no := ctr_no + 1;
total := recno + ctr_no;
if ctr_no > 4 then
exit;
end if;
dbms_output.put_line(recno||'+'|| ctr_no || '='|| total );
end loop;
recno := recno + 1;
ctr_no := 0;
if recno > 4 then
exit;
end if;
end loop;
end;
/
set serveroutput off