C language programes are executed in a sequence, but we can control the execution of C program by using any control mechanism by which we can compare things and come to a decision. This involves using some operations called Relational Operators, conditional statements called if-else and loops. We have fundamental operators to compare two values.

These relational operators compare two values and return true or false after comparison. We can use the relational operators to compare values of any basic data type, so all we need is to modify the behavior of the program.

“The relational operators compare two values of any basic data type and return true or false after comparison.”

Here are the examples of Conditional Operators

  1. < Less than
  2. > Greater than
  3. == Equal to
  4. <= Less than or equal to
  5. >= Greater than or equal to
  6. != Not equal to

The decision control structure in C can be implemented using

  1. The if statement
  2. The if – else statement
  3. The conditional operators

The if statement by itself will execute a single statement or a group of statements when the condition following if is true

If the condition is false then a group of statements can be executed using else statement

The simple example of an if statement is:

We can use the block to specify the statements to pre executed if the given condition is true

These are three methods by way of which we can repeat a part of a program in C programming

  1. Using a for statement
  2. Using a while statement
  3. Using a do-while statement

The for statement is started with the keyword for . There are three expressions which appear with in a for statement.

  1. Initializing Expression
  2. Test Expression
  3. Increment Expression

It has the following standard form.

The while loop continues untill the specified condition is true. The general form of while loop is

The do-while loop is similar to the while loop in that the loop continues as long as the specified loop condition remains true. The main difference is that the condition is checked at the end of the do-while statement. So do-while loop is always executed at least once. Its general form is