# How do you enter month number and print number of days in that month?

Page Contents

## How do you enter month number and print number of days in that month?

1. int a={31,28,31,30,31,30,31,31,30,31,30,31},m; printf(“Enter the month:”);
2. scanf(“%d”,&m); if(m>12 || m<1)
3. printf(“Invalid input”);
4. } else if(m==2)
5. { printf(“no of days in month 2 is either 29 or 28”);
6. printf(“no of days in month %d is %d”,m,a[m-1]);

## How many days in a month program in c?

For example, print 31 days if month == 1 since, January contains 31 days. Repeat the above step for all 12 months….Logic to find number of days in a month.

Month Total days
January, March, May, July, August, October, December 31 days
February 28/29 days

## How do I print the number of days in a month?

Method – 2: using Switch Statements:

1. Get the input month as a number N.
2. Using switch statement when value of N is one of 1, 3, 5, 7, 8, 10, 12, then print “31 Days.” corresponding to switch case.
3. If N is one of these value 4, 6, 9, 11, then print “30 Days.” corresponding to switch case.

## How do I print the number of days in a month in Python?

How to print the days in a given month using Python?…Number of days in a month in Python

1. if m = 2, then. if y is a leap year, return 29, otherwise 28.
2. make an array with elements [1,3,5,7,8,10,12]
3. if m is in the list, then return 31, otherwise, return 30.

## What is enter number of days?

Number of Days means a number of calendar days calculated from the date of termination of the Deposit agreement until the date of the Deposit‟s maturity. webew7 and 4 more users found this answer helpful.

## How do I print the next date in python?

Get Previous, Current and Next-Day System Dates in Python

1. Current Date: import datetime Current_Date = datetime.datetime.today() print (Current_Date)
2. Previous Date: import datetime Previous_Date = datetime.datetime.today() – datetime.timedelta(days=1) print (Previous_Date)

## How do you write an algorithm for a leap year?

To determine whether a year is a leap year, follow these steps:

1. If the year is evenly divisible by 4, go to step 2.
2. If the year is evenly divisible by 100, go to step 3.
3. If the year is evenly divisible by 400, go to step 4.
4. The year is a leap year (it has 366 days).
5. The year is not a leap year (it has 365 days).

## How many days does each month have?

All months have 30 or 31 days, except for February which has 28 days (29 in a leap year). Every fourth year, the month of February has 29 days instead of 28. This year is called a “leap year” and the 29th day of February is a “leap day”….Months of the Year.

 4 April Apr. 30 spring

## How to find number of days in month in C program?

Logic to find number of days in a month in C program. It contains 31 days. Total days in a months is given by below table. Step by step descriptive logic to find number of days in given month. Input month number from user. Store it in some variable say month.

## How to print number of days in month?

C++ program to enter month number and print number of days in month. C++ program to enter month number and print number of days in month. C++ program to enter month number and print number of days in month. I have used DEV-C++ compiler for debugging purpose.

## How to read month number in C # sharp?

Previous: Write a program in C# Sharp to read any Month Number in integer and display Month name in the word. Next: Write a program in C# Sharp which is a Menu-Driven Program to compute the area of the various geometrical shape.

## How to find number of days in a month in Java?

This program asks the user to enter any number between 1 to 12, where 1 = January, 2 = February, 3 = March,………., and 12 = December. Based on the user entered integer value, the program prints the number of days in that particular month. To accomplish this goal, we are using Else If Statement.