What are conditions ?
What are conditions ?
These are the statements that can yeild a value either 0 or 1 in other words true or false
To grant the ability to the computer to take decision based of conditions.
Operators : == , > , < , >= , && || , ! and <=.
1. >= - greater than and equal to
2. <= - less than and equal to
3. < - less than
4. > - greater than
5. == - equals to
6. ! - negation
7. && - and
8. || - or
if( __conditions__ )
{
statements;
.
.
}
Don't you think its quite instinctive.
if( __condition__ )
{
statements;
}
else //optional part
{
statements;
}
int x=1;
if(x==1)
{
x=x+3;
}
else
{
x=x+1;
}
Value of x=?
if(__condition__)
{ }
else if(__condition__)
{ }
else if(__condition__)
{ }
else
{ }
Q : Try a program to find a maximum out of three numbers using this concept