Computer Science, asked by tejpratapsingh98, 3 months ago

WAP to take two input DAY and MONTH and then calculate which day of

the year the given date is. For simplicity take month of 30 days for all. For e.g. if

the DAY is 5 and MONTH is 3 then output should be “Day of year is : 65”​

Answers

Answered by acharekarnishtha386
0

Answer:

public class switch4

{

   void main(int month , int year)

   {

       switch(month)

       {

           case 1:

           case 3:

           case 5:

           case 7:

           case 8:

           case 10:

           case 12:

           System.out.println("The number of days are "+31);

           break;

           case 4:

           case 6:

           case 9:

           case 11:

           System.out.println("The number of days are "+30);

           break;

           case 2:

           if (((year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0)))

           System.out.println("The number of days are "+29);

           else

           System.out.println("The number of days are "+28);

           break;

           default:

           System.out.println("Invalid Days");

       }

   }

}

Answered by 3f4d5ybwng
0

Answer:

d = int(input("Enter day: "))

m = int(input("Enter month: "))

n = (m - 1) * 30 + d

print("Day of the year:", n)

Explanation:

python code

Similar questions