- Syntax :
if (condition)
{
// block of code to be executed if the condition is true }
- Program :
#include <iostream>
using namespace std;
int main() {
cout <<"\n----------------IF STATEMENT----------------\n";
int a;
cout<<"\nEnter your age :";
cin>>a;
if (a >= 18) {
cout << "Major";
}
return 0;
}
- Output :
No comments:
Post a Comment