Computer Science, asked by aswani8797, 1 year ago

Write a program to take two inputs for day,month,and month and then calculate which day of the year

Answers

Answered by Equestriadash
5

The following codes have been written using Python.

Source code:

day = int(input("Enter a number of day: "))

month = int(input("Enter a number of month: "))

if month == 1:

   td = 31

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

elif month == 2:

   td = 59

   print("Day of the year:", td - day)

elif month == 3:

   td = 90

   print("Day of the year:", td - day)

elif month == 4:

   td = 120

   print("Day of the year:", td - day)

elif month == 5:

   td = 151

   print("Day of the year:", td - day)

elif month == 6:

   td = 181

   print("Day of the year:", td - day)

elif month == 7:

   td == 212

   print("Day of the year:", td - day)

elif month == 8:

   td = 243

   print("Day of the year:", td - day)

elif month == 9:

   td = 273

   print("Day of the year:", td - day)

elif month == 10:

   td = 304

   print("Day of the year:", td - day)

elif month == 11:

   td = 334

   print("Day of the year:", td - day)

elif month == 12:

   td = 365

   print("Day of the year:", td - day)

Answered by Anonymous
0

Answer:

The following codes have been written using Python.

Source code:

day = int(input("Enter a number of day: "))

month = int(input("Enter a number of month: "))

if month == 1:

   td = 31

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

elif month == 2:

   td = 59

   print("Day of the year:", td - day)

elif month == 3:

   td = 90

   print("Day of the year:", td - day)

elif month == 4:

   td = 120

   print("Day of the year:", td - day)

elif month == 5:

   td = 151

   print("Day of the year:", td - day)

elif month == 6:

   td = 181

   print("Day of the year:", td - day)

elif month == 7:

   td == 212

   print("Day of the year:", td - day)

elif month == 8:

   td = 243

   print("Day of the year:", td - day)

elif month == 9:

   td = 273

   print("Day of the year:", td - day)

elif month == 10:

   td = 304

   print("Day of the year:", td - day)

elif month == 11:

   td = 334

   print("Day of the year:", td - day)

elif month == 12:

   td = 365

   print("Day of the year:", td - day)

Similar questions