1if (condition) {
2 // block of code if condition is true
3}
4else {
5 // block of code if condition is false
6}
1// Program to check whether an integer is positive or negative
2// This program considers 0 as a positive number
3
4#include <iostream>
5using namespace std;
6
7int main() {
8 int number;
9
10 cout << "Enter an integer: ";
11 cin >> number;
12 if (number >= 0) {
13 cout << "You entered a positive integer: " << number << endl;
14 }
15 else {
16 cout << "You entered a negative integer: " << number << endl;
17 }
18 cout << "This line is always printed.";
19 return 0;
20}