Input a month number between 1 and 12 and a 4-digit year, and print number of days in that month. For February (month = 2), check for leap year to display number of days equal to 28 or 29.

What will be an ideal response?

```
SQL> DECLARE
2 m NUMBER(2) := &month;
3 y NUMBER(4) := &year;
4 BEGIN
5 IF m=2 AND ((MOD(y,4)=0 AND MOD(y,100)!=0) OR MOD(y, 400)=0) THEN
6 DBMS_OUTPUT.PUT_LINE(m || ' has 29 days in ' || y);
7 ELSIf m=2 THEN
8 DBMS_OUTPUT.PUT_LINE(m || ' has 28 days in ' || y);
9 ELSIF m=1 OR m=3 OR m=5 OR m=7 OR m=8 OR m=10 OR m=12 THEN
10 DBMS_OUTPUT.PUT_LINE(m || ' has 31 days');
11 ELSIF m=4 OR m=6 OR m=9 OR m=11 THEN
12 DBMS_OUTPUT.PUT_LINE(m || ' has 30 days');
13 ELSE
14 DBMS_OUTPUT.PUT_LINE(m || ' is invalid month');
15 END IF;
16 END;
17 /
Enter value for month: 2
Enter value for year: 2000
2 has 29 days in 2000

PL/SQL procedure successfully completed.

SQL> /
Enter value for month: 2
Enter value for year: 1991
2 has 28 days in 1991

PL/SQL procedure successfully completed.

SQL> /
Enter value for month: 3
Enter value for year: 2004
3 has 31 days

PL/SQL procedure successfully completed.

SQL> /
Enter value for month: 4
Enter value for year: 2000
4 has 30 days

PL/SQL procedure successfully completed.
```

Computer Science & Information Technology

You might also like to view...

Black and white and sepia are examples of ________ effects that can be applied to an image

Fill in the blank(s) with correct word (s).

Computer Science & Information Technology

________ is using computers and computer networks in a subversive way to promote an agenda such as free speech

Fill in the blank(s) with correct word

Computer Science & Information Technology