programming-examples/c++/Basic/Check Positive or Negative.cpp

20 lines
484 B
C++
Raw Normal View History

2019-11-18 14:44:36 +01:00
#include <iostream.h>
#include<conio.h>
void main()
{
clrscr(); //clear screen
int number;
cout<< "Enter an integer: ";
cin>> number;
if ( number >= 0)
{
cout << "You entered a positive integer: "<<number<<endl;
}
else
{
cout<<"You entered a negative integer: "<<number<<endl;
}
cout<<"This statement is always executed because it's outside if...else statement.";
getch();
}