If statement in C++

If block contains the condition, if condition is true, then the statement will execute and if the condition is not true then the statement will not execute.

Syntax :

//statements will execute if the boolean expression is true

Block Diagram :


using namespace std; 
int main () {
   // local variable declaration:
   int a = 10; 
   // check the boolean condition
   if( a < 20 ) {
      // if condition is true then print the following
      cout << "a is less than 20" << endl;
   cout << "value of a is : " << a << endl; 
   return 0;
a is less than 20
value of a is : 10

Next topic is if-else in C++


Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at info@prowessapps.in

Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at info@prowessapps.in


(8AM to 10PM):

+91-8527238801 , +91-9451396824

© 2017, prowessapps.in, All rights reserved