Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
715 B
2
Indexable
Never
 SET SERVEROUTPUT ON;
 declare
 fac number:=1;
 n number :=&1;
 begin
 while n>0 loop
 fac:=n*fac;
 n:=n-1;
 end loop;
 dbms_output.put_line(fac);
 end;
 /


SET SERVEROUTPUT ON;
declare
n number;
rev number :=0;
r number;
begin
n:=&n;
while n>0 loop
r:=mod(n,10);
rev:=(rev*10)+r;
n:=trunc(n/10);
end loop;
dbms_output.put_line(rev);
end;
/


SET SERVEROUTPUT ON;
declare
n1 number:=&n1;
n2 number:=&n2;
n3 number:=&n3;
begin
if(n1>n2) then
if(n1>n3) then
dbms_output.put_line('n1 greater');
else
dbms_output.put_line('n3 greater');
end if;
else
if(n2>n3) then
dbms_output.put_line('n2 greater');
else
dbms_output.put_line('n3 is greater');
end if;
end if;
end;
/
Leave a Comment