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
Where does Reiner take eren after they have a fight?
Tom [10]

Answer:

So Reiner And Bertoldt wanted to take Eren and Ymir to Marley, a nation on the other side of the ocean so they can be devoured and there power can be given to a warrior canidate.

5 0
3 years ago
Read 2 more answers
¿porque y como surge la informatica y las computadoras
LekaFEV [45]

Answer: La informática es el futuro: un puente hacia todas las cosas útiles.

La informática aprovecha el poder y la posibilidad de la tecnología digital para transformar datos e información en conocimiento que la gente usa todos los días. Este fuerte enfoque en el uso humano de la informática ayuda a las personas a interactuar con la tecnología de la mejor y más eficiente manera posible.

Explanation:

8 0
2 years ago
The term generally used to describe storage systems that function at high speeds is:
Alinara [238K]
The term to describe storage systems that function at high speeds is primary memory.
6 0
3 years ago
What key do you press so you can switch tabs quickly?
ss7ja [257]
Alt and tab to switch to open applications
4 0
3 years ago
PLEASE HELP I'M TAKING A QUIZ AND I HAVE 5 MINUTES LEFT
larisa [96]

Answer:

pp popo

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • A patent facilitates a government-approved technological monopoly by
    5·1 answer
  • What aspect do you need to keep in mind when you add images in a word document?
    11·2 answers
  • Describe Network in terms of the classroom computer lab
    14·1 answer
  • Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outpu
    9·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • In this mode, your presentation will fill up the entire screen. Auto Default Standard Window
    6·2 answers
  • The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current cal
    5·1 answer
  • Select the correct answer
    15·1 answer
  • How do we Rewrite the following Python code to avoid error. mark=inpt("enter your mark ")
    6·1 answer
  • Figure out what this says:<br><br> ?driew tib a kool ti seoD
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!