1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lilavasa [31]
3 years ago
14

Write a function called valid_date that takes three positive integer scalar inputs year, month, day. If these three represent a

valid date, return a logical true, otherwise false. The name of the output argument is valid. If any of the inputs is not a positive integer scalar, return false as well. Note that every year that is exactly divisible by 4 is a leap year, except for years that are exactly divisible by 100. However, years that are exactly divisible by 400 are also leap years. For example, the year 1900 was not leap year, but the year 2000 was. Note that your solution must not contain any of the date related built-in MATLAB functions
Mathematics
1 answer:
Temka [501]3 years ago
7 0

Answer:

Check the explanation

Step-by-step explanation:

function [valid]=valid_date(y, m, d)

if ~isscalar(y)  || ~isscalar(m)  || ~isscalar(d)  

   valid=false;

   return

end

   if y>=1 && m>=1 && m<=12  && (ismember(m, [4 6 9 11]) && ismember(d, [1:30])) || (ismember(m, [1 3 5 7 8 10 12]) && ismember(d, 1:31))  

   valid=true;

elseif m==2 && (mod(y,4)==0 && mod(y,100)~=0 || mod(y,400)==0 && mod(y,100)==0) && ismember(d, 1:29)  

       valid=true;

   elseif m==2 && ismember(d, 1:28)  

       valid=true;

   else

       valid=false;

       return

   end

   

end

You might be interested in
At a construction job for a mansion there are 37 painters. Of these painters, 67.6% of them paint the interior of the mansion. H
Inessa05 [86]
This is a relatively easy question to answer. You want to find 67.6% OF 37 mean you need to multiply. 37*0.676≈25. There should be 25 painters painting the interior.
3 0
4 years ago
For the given figure, can you conclude m||n? Explain.
Alex_Xolod [135]
Yea since because I have no clue
8 0
3 years ago
T=mv^2/L<br><br> Write an equation that shows the given formula solved for V
Effectus [21]

Answer:

<u>v = √(LT/m)</u>

Step-by-step explanation:

Given :

  • T = mv²/L

Multiply both sides with L :

  • T × L = mv²/L x L
  • LT = mv²

Divide both sides by m :

  • LT × 1/m = mv² × 1/m
  • LT/m = v²

Take the square root on each side :

  • √v² = √(LT/m)
  • <u>v = √(LT/m)</u>
3 0
2 years ago
Read 2 more answers
Sally's cat is 5 years older than Helen's dog. The product of their ages is 104. How old is Helen's dog?
kotykmax [81]
Helen's dog is 8 and Helens cat is 13 if you multiply those two together you get a product of 104 so the answer is C = 8
3 0
3 years ago
Read 2 more answers
PLS HELP! WILL GIVE BRAINLIST!
Vlad [161]

Answer:

y = 3x

Step-by-step explanation:

y = 13

x= 4

here

y∝x

that is

y= k x where k is constant

Since the equation is in the formy=kx we know that

13=K×4

k=13/4=3.25

so we can write this

y = 3.23 x ≅ 3x

4 0
3 years ago
Other questions:
  • Heather practices soccer and piano. Each day she practices piano for 2 hours. After 5 days, she practiced both piano and soccer
    10·1 answer
  • I need help with question C &amp; D.
    9·1 answer
  • What multiple of 10 can be used to remove the decimals and fractions in this equation?
    12·1 answer
  • What is the expression that is equivalent to 26 only using 3,4,5,7,9 and +,-,divide,multiple
    6·1 answer
  • 2p + 8 = 20-P<br> 2p + 8 + p = 20-p+p<br> 3p + 8 = 20<br><br> what’s the value of p ?
    14·2 answers
  • Find the values of the variables in the parallelogram.
    9·1 answer
  • Move point C and observe how the
    15·1 answer
  • (24 ÷ 3 - 2) × 4 [points n brainliest]
    7·1 answer
  • Show 9/12 as the sum of unit fractions
    6·2 answers
  • When you brush your wig will all the hair come off the wig completely or will it still be the same in a year
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!