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
Sergio [31]
3 years ago
10

Write a program that prompts the user to input a number. The program should then output the number and a message saying whether

the number is positive, negative, or zero.
Computers and Technology
1 answer:
Gala2k [10]3 years ago
7 0

Answer:

Following is the program in C++ Language

#include <iostream> // header file

using namespace std; // namespace std

int main() // main method

{

   int n;  // variable declaration

   cout<<" Please enter the number :";

   cin>>n; // Read the number

   if(n>0) // check the condition when number is positive

   {

cout<<n<<endl<<"The number is Positive"; // Display number

   }

  else if(n<0) // check the condition when number is Negative

  {

cout<<n<<endl<<"The number is Negative";// Display number

  }

  else // check the condition when number is Zero

  {

cout<<n<<endl<<"The number is Zero";// Display number

  }

   return 0;

  }

Output:

Please enter the number:

64

The number is Positive

Explanation:

Following are the description of the program

  • Declared a variable "n" of int type.
  • Read the value of "n" by user.
  • Check the condition of positive number by using if block statement .If n>0 it print the number is positive.
  • Check the condition of negative number by using else if block statement If n<0 it print the number is negative.
  • Finally if both the above condition is fail it print the message " The number is Zero"

You might be interested in
Which branch of science helps avoid or minimize stress-related injuries at workplace?
worty [1.4K]
Psychology, because psychology is the study of how the mind works, and therefor what causes stress.
3 0
3 years ago
Read 2 more answers
What do you remember about the difference between Canadian and US dollar (which one is greater)? Also, explain which online tool
Talja [164]
I’m not sure about USD but Canadian dollars are greater, one dollar CAD is equal to $0.79 US. So $10 CAD is equal to $7.90 US.
8 0
2 years ago
Match each method of communication with its intended purpose.
Scorpion4ik [409]

Answer:

1. a late breaking news story = to inform

2. a poetry reading = to entertain

3. an advertisement = to persuade

4. a small group assignment = to collaborate

Explanation:

1. A "breaking news" tells people of what is happening in the society. It <em>informs </em>them of the occurrence of an important event such as the plane crash of Kobe Bryant.

2. Poetry reading is meant to touch the attention of listeners. It tries to entertain them through the poem's interesting verses.

3. An advertisement is being shown/displayed in order to convince people to buy a particular product or service.

4. A group assignment allows the members of the group to contribute their ideas together. Such situation is known as "collaboration." They try to brainstorm together towards a common goal.

7 0
3 years ago
What is a set of javascript statements that result in an action?
AlexFokin [52]

function is the right answer because function is a block of code designed to perform a particular task

4 0
3 years ago
Students enrolled in a digital classroom participate in discussions and take field trips with classmates. watch instructional vi
krek1111 [17]

Answer:b

Explanation:gszrxewzgdtxherhzre

7 0
3 years ago
Other questions:
  • List 3 ways that you can use excel and the features it includes and explain why a spreadsheet is the best choice for this task.
    5·1 answer
  • A video streaming website uses 32 bit integers to count the number of times each video is played. In anticipation of some videos
    14·2 answers
  • You need to install an operating system on a computer that will be sharing files for the company employees. You estimate there w
    9·1 answer
  • Can Algorithms Be Used Again?
    8·1 answer
  • A town government is designing a new bus system. The planners are deciding where to put the different bus stops. They want to pi
    6·2 answers
  • HELP PLS
    5·2 answers
  • In what type of attack does the attacker have the ciphertext of several messages that were encrypted with the same encryption al
    14·1 answer
  • Which type of mic is durable, versatile and does not rely on power?
    14·2 answers
  • Can somebody please help me with these few questions?
    11·1 answer
  • When heading styles have been applied to a document, the user has the option to navigate through the document using which tab on
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!