Q.Write a program to take two inputs for day, month and then calculate which day of the year, the given date is .for simplicity; take 30 days for all month.

For example: If you give input as: day = 3, month = 2

Then it should print “day of the year: 33”.


You can understand by Watching video :-



Answer :-

day = int(input("Enter the date = "))
month = int(input("Enter the month = "))
print("Number of total days in year = ",30*(month -1 )+day)

Output :-

Enter the date = 22
Enter the month = 5
Number of total days in year =  142

>>> 

Enter the date = 30
Enter the month = 8
Number of total days in year =  240

>>> 

Enter the date = 16
Enter the month = 11
Number of total days in year =  316

>>>

9 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post