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
Please choose the correct answer please tell fast​
pav-90 [236]

Answer:

the answer might be 2......

7 0
3 years ago
A driver that approaches a controlled intersection with a signal that is not working must:
nalin [4]
You must stop at the intersection and proceed when you are aware that other turning or approaching vehicles,bicycles or pedestrians have stopped.
5 0
3 years ago
Unless you explicitly initialize global variables, they are automatically initialized to
shusha [124]

Answer:

Zero(0)

Explanation:

<u>Global Variables </u>

Variables which are declared outside any function. Any function can use these variables,they are automatically initialized to zero(0).They are generally declared before main() function.

Example- C program for showing global variable is 0.

  #include <stdio.h>

   int g;  // declaring g as global variable

   int main()

   {

       printf("%d",g);  //printing global variable

       return 0;

    }

<u>Output</u>

  0

4 0
3 years ago
Help me please. i need you help​
Fudgin [204]

Answer:

Can you provide the code

7 0
3 years ago
Why do we need multitasking functionality in an Operating System?
Leokris [45]

Answer:

Multitasking is a process in which we do multiple task at a time.    

In computing system, multitasking is the concept of performing different types of multiple task and process over a certain period of time by executing simultaneously.

Operating system basically allow various task to run simultaneously by the user. In an operating system, each task consume storage system and all the other resources.

Multitasking function facilitate memory isolation in the processor and also supported different levels of security system in the operating system. For example, "a programmer working on any program in a system and as well as listening the music then, it perform multiple task at the same time".

7 0
2 years ago
Other questions:
  • A(n) ____ is a client, server, or other device that can communicate over a network and is identified by a unique number, known a
    10·1 answer
  • If Johanna wants to label the x- and y-axes in Excel she should click Layout, then what?
    12·1 answer
  • Write a couple of paragraph on 'limited government and its important'?​
    7·1 answer
  • The icon below represents the ____________.
    8·1 answer
  • The ______ is the information center that drivers need to refer to when they're NOT scanning the road.
    14·1 answer
  • The concept of "space" on a computer usually refers to the___.​
    7·1 answer
  • 6.An organization wants to implement a remote dial-in server to ensure that personnel can connect to the organization's network
    11·1 answer
  • ou use productivity apps on your iPad tablet device while traveling between client sites. You're concerned that you may lose you
    11·1 answer
  • Sự ra đời của thương mại điện tử có tác động như thế nào đến việc quảng cáo và Marketing sản phẩm
    11·2 answers
  • Help me pls...
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!