declare
a number;
b number;
c number;
choice varchar2(10);
function dividemy(x in number, y in number) return number is
z number;
begin
z := x / y;
return z;
end;
function multiplymy(x in number, y in number) return number is
z number;
begin
z := x * y;
return z;
end;
function subtractmy(x in number, y in number) return number is
z number;
begin
z := x - y;
return z;
end;
function addmy(x in number, y in number) return number is
z number;
begin
z := x + y;
return z;
end;
begin
dbms_output.put_line('Enter the first number');
a:=&enternum1;
dbms_output.put_line('Enter the second number');
b:=&enternum2;
dbms_output.put_line('Enter your operation choice');
choice:='&symbol';
/* if choice='+' then
c:=addmy_num(a,b);
else if choice='-' then
c:=subtract(a,b);
else if choice='*' then
c:=multiply(a,b);
else if choice='/' then
c:=divide(a,b); */
case choice
when '+' then
c:=addmy(a,b);
dbms_output.put_line('The addition of two number is : '||c);
when '-' then
c:=subtractmy(a,b);
dbms_output.put_line('The subtraction of two number is : '||c);
when '*' then
c:=multiplymy(a,b);
dbms_output.put_line('The multiplication of two number is : '||c);
when '/' then
c:=dividemy(a,b);
dbms_output.put_line('The Divide of two number is : ' ||c);
else
dbms_output.put_line('No option selected');
end case;
end;
Comments
Post a Comment