Syntax:
if ( condition )
{
// if condition is true then this block execute
}
else
{
if condition is false then this block execute
}
Example:
#include <iostream>
using namespace std;
int main() {
int i ;
cin>> i ;
if (i > 2)
{
cout<<" i grater then 2 ";
}
else
{
cout<<"i smaller then 2 ";
}
return 0;
}
No comments:
Post a Comment