Elsa is new to concept of positive and negative numbers. Can you help her to check whether the given number is positive or negative. consider input as a positive integer. consider 0 as positive integer
Answers
Answered by
2
Answer:
We'll write an algorithm
Explanation:
Ask user input
store it in x
if x>=0 then it is a positive number.
else
print it is a negative number.
Answered by
1
Answer:
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
if(a>=0)
{
cout<<" is a positive number.";
}
else
{
cout<<a<<" is a negative number";
}
}
Explanation:
Similar questions