Computer Science, asked by tcjishnuprasad, 1 year ago

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 sswaraj04
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 gauravuniyal4
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