Write a PL-SQL block to find out if a year is leap year (A leap year is divisible by 4 but not by 100, or it is divisible by 400)

 
DECLARE
 year number(4):=&year;
 BEGIN
 if(mod(year,100)=0) then
 if(mod(year,400)=0) then
 dbms_output.put_line('Leap year');
 else
 dbms_output.put_line('Non Leap year');
 end if;
 elsif(mod(year,4)=0) then
 dbms_output.put_line('Leap year');
 else
 dbms_output.put_line('Non Leap Year');
 end if;
 end;
/
 

Cookies Consent

This website uses cookies to ensure you get the best experience on our website.

Read More