Greatest of Three Numbers
declare
a number;
b number;
c number;
begin
a:=&a;
b:=&b;
c:=&c;
if(a>b) and (a>c) then
dbms_output.put_line('A is greater ');
elsif (b>a) and (b>c) then
dbms_output.put_line(' B is Greater ');
else
dbms_output.put_line('C is Greater');
end if;
end;
SQL> /
Enter value for a: 20
old a:=&a;
new a:=20;
Enter value for b: 15
old b:=&b;
new b:=15;
Enter value for c: 3
old c:=&c;
new c:=3;
A is greater
declare
a number;
b number;
c number;
begin
a:=&a;
b:=&b;
c:=&c;
if(a>b) and (a>c) then
dbms_output.put_line('A is greater ');
elsif (b>a) and (b>c) then
dbms_output.put_line(' B is Greater ');
else
dbms_output.put_line('C is Greater');
end if;
end;
SQL> /
Enter value for a: 20
old a:=&a;
new a:=20;
Enter value for b: 15
old b:=&b;
new b:=15;
Enter value for c: 3
old c:=&c;
new c:=3;
A is greater
No comments:
Post a Comment