Sunday, June 6, 2021

If-else-if Ladder in c-programming


 if-else-if Ladder:

 A common programming construct is the if-else-if ladder, sometimes called the it- else-if staircase because of its appearance.

Syntax:

           if(Expression-1) 

                  statement-1; 

           else if(Expression-2) 

                         statement-2; 

                    else if(Expression-3) 

                                statement-3; 

                                 - - - - - - - 

                                 - - - - - - -

                                else if(Expression-N)

                                           statement-N; 

                                   else 

                                           statement-F;

The expressions are evaluated from the top downward .

As soon as a true expression is found, the statement associated with it is executed and the rest of the ladder is bypassed .

If none of expression are true, the final else is executed. 


No comments:

Post a Comment

Object Paradigm Oriented Programming in C++ / object oriented programming / History of C++/ paradiagram in c++/C devolop, Operating System, Unix operating system, Assembly language, popular in world, Programming language.

  Object Paradigm Oriented Programming  Two programmers, Brian Kernighan and Dennis Ritchie developed a new language called C, in 1972.  C l...