Posts

Showing posts from June, 2021

Decision making statements and Switch Statements

  Decision Making Statements In decision control statements( if else and nested if ), group of statements are executed when condition is true. If condition is false, then else part statements are executed. There are 3 types of decision making control statements in C language. They are, 1. if statements 2. if else statements 3. nested if statements Decision Making Statements - Syntax S.No if statement if…else statement nested if 1.Syntax if(condition) { Statements; } if(condition) { Statement1; Statement2; } else { Statement3; Statement4; } Decision Making Statements - if Example program for if: In “if” control statement, respective block of code is executed when condition is true. main() { int m=40,n=40; if (m == n) { printf("m and n are equal"); } } Output: m and n are equal Decision Making Statements - if else Example program for C – if else: In C if else control statement, group of statements are executed when condition is true. If condition is false, then else part statem...