A plsql programme to print 103,99,96...3?
PL/SQL program to print numbers in descending order from 103 to 3
Use a loop to iterate from 103 to 3
Print each number in the loop
Decrement the loop counter by 3 in each iteration
ls=[103]
for i in range(4,103,3):
ls.append(str(ls[0]-i))
print(ls)
above is in python
set serveroutput on;
declare
i number :=103;
i_target number :=100;
begin
DBMS_OUTPUT.put_line(i);
while(i>3) loop
if(i>i_target) then
i:=i-4;
else
i:=i-3;
end if;
DBMS_OUTPUT.put_line(i);
end loop;
end;
Begin
For i reverse 1..103
Loop
If mod(i,3)=0 then
Dbms_output.put_line( i);
End if;
End loop;
End;
set serveroutput on ;
declare
x number;
begin
for i in reverse 1..102 loop
if mod(i,3)=0 then
dbms_output.put_line(i);
end if;
end loop;
end;
Declare
i number;
Begin
for i in reverse 1..103
loop
dbms_output.put_line(i);
end loop;
end;
Declare
i number;
Begin
for i in reverse 1..103
loop
if mod(i,3)=0 then
dbms_output.put_line(i);
end if;
end loop;
end;
Popular interview questions of Plsql Developer
Reviews
Interviews
Salaries
Users/Month