Saturday, May 10, 2008

Decision control & conditional statements

Decision control & conditional statements

Decision control statements and Conditional Statements
allow the computer to take decision. And force to work
under given condition:

Decision control statements:

It gives the control to the computer for taking the decisions.

Two decisions control instruction which are implemented
in C are following:

a) The if statements.

b) The if-else statements.

General form of if statements is:
if (condition is true) execute this statement;

A structure image of if condition >



Here we can add else statement also as follow:

else
printf("you have enter number greater than 50");
}

An example of if-else statement:




output:



Explanation of the program:

In the above given program you will be asked to enter
any no which is less than 50.

Suppose you enter 47 then you will get output, you have
entered no. less than 50 value.

Otherwise you have entered number greater than 50.

A structure image of if else condition >







0 comments:

Copyright

Copyright © 2008 C Tutorial, All rights are reserved