Answer to Question #267757 in C++ for mickey

Question #267757

Using if...else if statement, make a program that will ask a number and determine if the inputted number is "positive", "negative", or "zero" c++


1
Expert's answer
2021-11-17T17:29:30-0500

SOLUTION CODE


#include<iostream>


using namespace std;
int main(){
	//propmt the user for a number
	int number;
	cout<<"Enter a number : ";
	cin>>number;
	
	if(number == 0)
	{
		cout<<"The input number "<<number<<" is a zero"<<endl;
	}
	else if(number>0)
	{
			cout<<"The input number "<<number<<" is a positive"<<endl;
	}
	else
	{
			cout<<"The input number "<<number<<" is a negative"<<endl;
	}
	
	 return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS