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
Nostrana [21]
3 years ago
8

Write a program that inputs an integer denoting a month (1 for January, 2 for February, ... , 12 for December), and outputs how

many days are in that month. Assume no leap years. For example, if the input is 2, the output is 28. If the input is 11, the output is 30.[ There are a variety of ways to do this...One approach is to use 12 separate if-then statements. Another approach uses just 3 if-then statements and the logical OR operator (which is ||). ]
Computers and Technology
1 answer:
Korolek [52]3 years ago
6 0

Answer:

// program in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int inp_month;

cout<<"Enter month:";

// read month

cin>>inp_month;

// if month is february

if(inp_month==2)

cout<<"Number of days in month:28"<<endl;

// if month is 4 or 6 or 9 or 11

else if(inp_month==4||inp_month==6||inp_month==9||inp_month==11)

cout<<"Number of days in month:30"<<endl;

else

// for others month

cout<<"Number of days in month:31"<<endl;

return 0;

}

Explanation:

Read month from user and assign it to variable "inp_month".If month is 2 then  there is 28 days in the month.If input month is 4 or 6 or 9 or 11 then there is 30 days in the month.For other month there will be 31 days in month.We assume there is no leap year.

Output:

Enter month:4                                                                                                              

Number of days in month:30

You might be interested in
What is ur Favorite anime
jok3333 [9.3K]

Answer:

one piece lol

Explanation:

8 0
3 years ago
In a well-developed paragraph - using domain-specific vocabulary and academic writing - address the following writing prompt:
egoroff_w [7]

Answer:

GIGO is a computer science acronym that implies bad input will result in bad output. Good programming practice dictates that functions should check for valid input before processing it. ... A well-written program will avoid producing garbage by not accepting it in the first place.

Explanation:

4 0
2 years ago
2. Add a _______ to manually force text from one page to the next page. A. footer B. page break C. blank page D. header
Morgarella [4.7K]
The answer is: b) page break. 
5 0
3 years ago
Read 2 more answers
Atheel tests a program and gets a NameError. How can this be fixed?
Oksana_A [137]

Answer:

You can't call a function unless you've already defined it. Move the def createDirs(): block up to the top of your file, below the imports.

Explanation:

Some languages allow you to use functions before defining them. For example, javascript calls this "hoisting". But Python is not one of those languages.

7 0
3 years ago
Read 2 more answers
A hacker has successfully infected an internet-facing server which he will then use to send junk mail, take part in coordinated
julia-pushkina [17]
Botnet Trojan. Hopefully that’s helpful :)
5 0
3 years ago
Other questions:
  • _____ separation strategies (e.g., attacking and sabotaging others) are used by those for whom co-cultural segregation is an imp
    5·1 answer
  • Markaplier nand jackceptieye are the best YT ever who agrees
    5·2 answers
  • How many bits would be in the memory of a computer with 4kb memory?
    8·1 answer
  • You are a network technician for a small corporate network. It's been decided that the office needs a wireless network for emplo
    6·1 answer
  • ListenListen with ReadSpeakerAn administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on
    9·1 answer
  • Find two consecutive even integers such that twice the smaller is 16 more than the larger
    10·1 answer
  • You can't get close enough to the facility interior to launch an evil twin attack against its wireless clients; in fact, you hav
    11·1 answer
  • Which of the following is NOT an argument used to determine how a shot is fired from an A. object the shot itself being instanti
    12·1 answer
  • Where do you place the logical test argument in an JF function formula?
    5·2 answers
  • Select the correct answer.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!