C – do while loop

do-while loop in C is just as same as while loop, the only difference is that in do-while the condition is always executed after the loop as shown in the syntax below. Unlike while loop, where the body of the loop is executed only if the condition stated is true but in the do-while loop, … Read more

C – while Loop

A while loop is a straightforward loop and is also an entry-control loop. It evaluates the condition before executing the block of the loop. If the condition is found to be true, only then the body of the loop is executed. The loop continues until the condition stated is found to be false. while loop … Read more

C – for loop

In C programming, for loop is a more efficient loop structure and is an entry-control loop. The iteration continues until the stated condition becomes false. It has three computing steps as shown in the syntax below. for loop Flowchart: Syntax of for loop. Example of for loop in C Program. The output of for loop in C … Read more

C – switch statement

A switch statement allows a variable to be tested for equality against multiple values and each of those values is called a case. It can be used instead of nested if…else. Switch expression and case value must be of the same type. There must be at least one case or multiple cases with unique case … Read more

C – nested switch statement

The use of switch statement inside another switch statement is called nested switch statement. Syntax Syntax of nested switch statement in C: Example of nested switch statements in C: The output of nested switch statements in C. The OUTER Switch. The INNER Switch.

C – if statement

An if statement consists of a Boolean expression followed by one or more statements.If the boolean expression is true, the block of code inside the if statement will be executed else not. Syntax Syntax of if statement in C: if statement Flowchart: Example of if statement in C Program: The output of if statement in C. num1 is … Read more

C – if…else statement

If the Boolean expression is true then the code inside the if statement block is executed or if it is false then the code inside else statement will be executed. Hence if..else statement. Syntax Syntax of if…else statement in C Language: If…else Flowchart: Example of if…else statement in C. The output of if…else statement in C. … Read more

C – nested if statements

This statement allows the user to use if block inside the other if block. And the inner if statement is executed only if the outer if statement’s condition is true. Syntax Syntax of nested if statement in C: nested if Flowchart: Example of nested if statement in C: The output of nested if statement in C. … Read more