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
cestrela7 [59]
2 years ago
7

write a program that asks the user for a month number and displays the number of days that month has?

Computers and Technology
2 answers:
adoni [48]2 years ago
7 0

Answer:

I have used Python language for your question. Code is below in Bold Letters.

Explanation:

Code starts from next line.

print("1 for Jan\n2 for Feb\n3 for Mar\n4 for Apr\n5 for May\n6 for Jun\n7 for Jul\n8 for Aug\n9 for Sep\n10 for Oct\n11 for Nov\n12 for Dec")

a = int(input("Enter the number of a month: \n"))

b = 28

c = 29

d = 30

e = 31

if a == 1:

   print("The month January has", e, "days")

elif a == 2:

   print("The month Febuary has",b, "or", c, "days")

elif a == 3:

   print("The month March has", e, "days")

elif a == 4:

   print("The month April has", d, "days")

elif a == 5:

   print("The month May has", e, "days")

elif a == 6:

   print("The month June has", d, "days")

elif a == 7:

   print("The month July has", e, "days")

elif a == 8:

   print("The month August has", e, "days")

elif a == 9:

   print("The month September has", d, "days")

elif a == 10:

   print("The month October has", e, "days")

elif a == 11:

   print("The month November has", d, "days")

elif a == 12:

   print("The month December has", e, "days")

else:

   print("Enter a valid number")

Code ends here.

Those who found this answer helpful please give me a Thanks and support me. So, I can explain my answers more properly and give you the codes as short as possible. I am not saying to mark me brainliest but to give me Thanks.

uranmaximum [27]2 years ago
4 0

Answer:

Using c++

Explanation:

#include<iostream>

using namespace std;

int main() {

int num;

cout<<"ENTER THE NUMBER OF THE MONTH"<<endl;

cin>>num;

if(num<=1) {

cout<<"The first month is January and it has 31 days";

}

else if(num<=2) {

cout<<"The second month is February and it has 28 days";

}

else if(num<=3) {

cout<<"The third month is March and it has 31 days";

}

return 0;

}

For the remaining months all you need to do is follow these steps.

You might be interested in
From which Menu option you can change page setup in MS Word​
marissa [1.9K]

page layout tab or the page setup dialog box

8 0
2 years ago
A computer _________________ is a text file that a computer can understand
Gekata [30.6K]

Answer:

A computer ___Task__ is a text file that a computer can understand

6 0
2 years ago
Which two statements about using leased lines for your wan infrastructure are true? (?
Karo-lina-s [1.5K]
<span>The following statements are true: 1. Leased lines require little installation and maintenance expertise. ( A high service quality is offered by point-to point system) 2. Leased lines provide highly flexible bandwidth scaling. (This Allows a Constant availability)</span>
7 0
3 years ago
Write the following numbers in binary. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25
AfilCa [17]
0 1 10 11
Explanaition:
4 0
2 years ago
When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the
OLEGan [10]
Or pointer

VERY similar.
5 0
3 years ago
Other questions:
  • 2- There are many different design parameters that are important to a cache’s overall performance. Below are listed parameters f
    11·1 answer
  • Frank has created a résumé and separated the sections using headings. How can he set the headings apart from normal text?
    13·1 answer
  • What does this say:<br> √ans
    6·2 answers
  • Which of the following components controls the opening and closing of the valves in an engine ?
    15·2 answers
  • c++ 2.30 LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefi
    10·1 answer
  • Give sally sue specific suggestions on how she can improve her powerpoint skills.
    6·1 answer
  • Which of the following is another type of brake system used in trucks
    5·1 answer
  • PLS HURRY<br> Look at the image below
    8·1 answer
  • The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Pape
    15·1 answer
  • Which option ensures that items in a text box or table cell will be in the absolute center of that element?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!