if else statement in c++ programming
Image by Wikipedia |
#include<iostream>
using namespace std;
int main() {
int number;
cout << "Enter an integer: ";
cin >> number;
if (number > 0) {
cout << "You entered a positive integer: " << number << endl;
}
cout << "This statement is always executed.";
return 0;
}
Output--
Enter an integer: 4
You entered a positive integer: 4
This statement is always executed.
You entered a positive integer: 4
This statement is always executed.
Post a Comment