If Statement

If statement is implemented in two ways.
  • Simple if statement
  • if...else statement
Example:-
if...........else statement

#include
void main()
{
int a,b;
cout<<"Enter values for a and b\n";
cin>>a;
cin>>b;
if(a>b)
{
cout<<"Value of a is more than b\n";
else
{
cout<<"Value of b is more than a\n";
}
}
}

No comments:

Post a Comment