Programming in C++
1. Input a number and check whether it is positive, negative or zero.
brambord find the bar
F
Attachments:
Answers
Answered by
3
Answer:
#include <iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter a number";
cin>>a;
if(a<0)
cout<<"It's a negative number";
if(a>0)
cout<<"It's a positive number";
if(a==0)
cout<<"Zero";
return 0;
}
Explanation:
Hope it helps :-)
Answered by
0
Answer:
#include <iostream>
using namespace funtime;
int main()
{
int a=0;
cout<<"Enter a Number";
cin>>a;
if(a==0)
cout<<"Zero";
else if(a<0)
cout<<"It's a negative number";
else if(a>0)
cout<<"It's a positive number";
else
cout<<"wrong input!";
}
Similar questions