Pl -sql : Programming Concept.
--WRITE A PROGRAM TO PRINT EVEN NUMBERS FROM 1 TO 100
DECLARE
N NUMBER(3) :=0;
BEGIN
WHILE N<=100
LOOP
N :=N+2;
DBMS_OUTPUT.PUT_LINE(N);
END LOOP;
END;
--WRITE A PROGRAM TO PRINT EVEN NUMBERS FROM 1 TO 100
DECLARE
N NUMBER(3) :=0;
BEGIN
WHILE N<=100
LOOP
N :=N+2;
DBMS_OUTPUT.PUT_LINE(N);
END LOOP;
END;
What is the output of this code
ReplyDeleteIf you execute this, you will get below output..
Delete2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
@Hemalata Changes in Program
ReplyDeleteDECLARE
N NUMBER(3) :=0;
BEGIN
WHILE N<=100 -- Not Required Actually, it will print 1 to 102
LOOP
N :=N+2;
DBMS_OUTPUT.PUT_LINE(N);
exit when n = 100; -- We should exit the loop when n=100
END LOOP;
END;
Write a PL/SQL code to print tables of all even numbers up to
Delete10?
Can you solve this?