Skip to main content

Posts

Showing posts with the label nested if else statements

Control Statements: Decisions in C programming

     Since decision making statements control the flow of execution, they also fall under the category of control statements. Following are decision making statements: 1. if statements 2. if....else statements 3. else if statement 4. Nested if...else statement 5. switch statement  if statement: The if statement is a powerful decision making statement and is used to control the flow of execution of statements. This is a bi-directional condition control statements. This statement is used to test a condition and take one of two possible actions, If the condition is true then a single statement or a block of statements is executed (one part of the program), other wise another single statement or a block of statements is executed (other part of the program). In C, any non-zero value is regarded as true while zero is regarded as false. syntax : if (condition) if (condition) statement1 ; { statement1 ; - - - - - statement n ; } Here if the...