plsql

Pages

  • Home
  • Web Development
  • c programming
  • java programming
  • minor projects
  • Python Programming

Friday, 25 March 2016

wap to enter a number and check whether it is odd or even. if it is odd then display its cube and if it is even display its square

declare
    
    odd number;
    even number;
    n number;
    cube NUMBER;
    sq NUMBER;

begin
      n:=&n;
     odd:=mod(n,2);
     if odd=1 then
    cube:=POWER(N,3);
    DBMS_OUTPUT.PUT_LINE(CUBE||'    '||'ODD');
end if;                            
    even:=mod(n,2);
    if even=0 then
    sq:=power(n,2);
    DBMS_OUTPUT.PUT_LINE(sq||'    '||'even');
end if; 

end;
Posted by Varun wadhwa at 06:33
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Youtube Channel

Followers

Simple theme. Powered by Blogger.