Loops and Decision – if else, for and while

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


  1. please help me also in this question
    write a program to produce a conversion for weight from pounds to kilogram. start from 50lbs to 200lbs…the results of this program is going to be used in the next comelec registration.try to obtain the following results on the screen.

    Pounds Kilos
    100.00 45.45
    101.00 45.91
    102.00 46.36
    103.00 46.82
    104.00 47.27
    105.00 47.73
    106.00 48.18
    107.00 48.64
    108.00 49.09
    109.00 49.55
    110.0 …..

    please help me i need this tomorrow 1 pm email me (lawrence_dejesus21@yahoo.com)

    thank you

Leave a Reply