# C Program To Print Number Of Days In A Month | Java Tutoring

C program to input the month number and print the number of days in that month – In this article, we will expand on how to input the month number and print the number of days in that month in C programming.

Suitable examples and sample programs have also been added so that you can understand the whole thing very clearly. The compiler has also been added with which you can execute it yourself.

The method used in this piece is the usual Standard Method.

It is pretty much known to the whole civilized humanity that a year is divided in 12 months. These 12 months constitute the whole of 365 days (366 in case of a leap year).

The months are as follows:

As we can see, there is a cluster of 12 months in a whole year with different days in one another. The months are named accordingly as per their order:

1. January – 31 Days
2. February – 28 Days
3. March – 31 Days
4. April – 30 Days
5. May – 31 Days
6. June – 30 Days
7. July – 31 Days
8. August – 31 Days
9. September – 30 Days
10. October – 31 Days
11. November – 30 Days
12. December – 31 Days

As it is evident, each month has a specific number denoted to it. So, by knowing the month number, we can know how many days are there in that month.

Thus, the way to do so in C programming is as follows:

## Using Standard Method

1) Read the entered month number and store it in the variable n.

2) Check the month number using “if” condition, if month number is 1 or 3 or 5 or 7 or 8 or 10 or 12 then it prints no.of days in that month is 31.

3) If month number is 4 or 6 or 9 or 11 then it prints no.of days in that month is 20.

4) If month number is not matched with the above two if conditions then it prints no.of days is 29 or 28.

Output: