Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that accepts a month and a year (both in numbers) from the user and prints out the number of days in that

image text in transcribed

Write a program that accepts a month and a year (both in numbers) from the user and prints out the number of days in that month. Background: There are 31 days in January, March, May, July, August, October, or December, and 30 days in April, June, September, or November. If the year is a leap year, February has 29 days, otherwise it has 28 days. Any year that is evenly divisible by 4 is a leap year. For example, 1988, 1992, and 1996 are leap years. However, there is still a small error that must be accounted for. To eliminate this error, a year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400. For this reason, the following years are not leap years: 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600. This is because they are evenly divisible by 100 but not by 400. The following years are leap years: 1600, 2000, 2400. To determine if a number x is evenly divisible by another number y, in MATLAB, you can call a build-in function mod(x, y). If mod(x, y) is equal to 0, x is evenly divisible by y. For example, mod(1900, 100) is 0 and mod(1900, 400) is 300

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

what are the key details from documenting job descriptions

Answered: 1 week ago

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago