Write a program in c++ to check wether a number is positive, negative or zero
#include <iostream>
using namespace std;
int main()
{
int number;
while (number != 999){
cout << "Enter number (999 - exit): ";
cin >> number;
if (number > 0)
cout << "A number is pozitive" << endl;
else if (number < 0)
cout << "A number is negative" << endl;
else
cout << "Number is zero" << endl;
}
}
Comments
Leave a comment