Articles added in Mathematics Lab | Cyber Lab is now open | Astronomy Lab is now open | VLSI Lab is now open | 120 SEO Tips article published | More exciting articles coming soon!




If-else statements

Simple if statement:

Syntax:
if(condition)
{ //statement(s)
}
--> Condition is an expression whose value is 0 or 1.
--> Statement is any valid C++ statement.
--> if,else both are keywords.

e.g.
i) a=1;
if(a<5)
a++; //statement
cout<
ii) a=1;
if(a<5)
{a++;
b++; //statements
}
cout<< a<< b; //next statement



if-else statement:

Syntax:
if(condition)
{ //statement1
}
else
{ //statement2
}

e.g.
i) a=1;
if (a<5)
a++;
else
a--;

ii) a=1;
if (a<5)
{
a++;
b++;
}
else
{
a--;
b--;
}






CACKLE comment system





Programming Resources
Computer Networking Fundamentals Android Application