Explore
ProGrad Programs
Placement Prep
TCS Codevita
Live Placement Training
Live Aptitude Training
Live Programming Training
Webinars
About Us

Edit
Reply




Edit

Program to find the number of days in a given month of a given year | FACE Prep

Published on 09 Mar 2020

Program to find the number of days in a given month of a given year is discussed here. The month and year are given as input, the number of days in that month is displayed as output.


Sample Input:

3

1996


Sample Output:

Number of days is 31


Algorithm to find the number of days in a given month of a given year


  • Input the month and year from the user.
  • If the year is a leap year and (month == 2), display "Number of days is 29".
  • Else if (month == 2), display "Number of days is 28".
  • Else if((month == 1) ||(month == 3 || (month == 5) (month == 7) || (month == 8) || (month == 10) (month == 12)), display "Number of days is 31".
  • Else, display, "Number of days is 30".


Program to find the number of days in a given month of a given year is given below.


C
C++
Java
Python 3

Output
3
1996
Number of days is 31


Recommended Programs




If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in