Its been such a looong time isn't it ?
well .. I was busy .. engrossed in my work so much that I did not get time to study C ..... sorry for that . So lets start studying now.
The topic which we will touch is Decision Making which plays very important part in development of programs which we will soon learn. so tuck in .
While developing or creating an application or program we may not need to execute the situations sequentially. Decision making help us in determining the flow of the execution of the program. a decision control instruction or decision making can be implemented in C using:
(a) The if statement
(b) The if-else statement
(c) The conditional operators
For the time being lets look at the If statement.....
The If Statement
The syntax of if statement looks like this:
if ( this condition is true )
execute this statement ;
whenever if block comes it tells compiler that what comes after it is a decision control statement. If the condition is true then and only then execute the the statement otherwise move ahead and skip the if block.
The entries or statements within the two curly braces( { , } )are called as block
But do you know what the important thing I have missed ????
..
..
..
..
..
..
How will we know whether the condition is true or not ??
The answer is ..... wait for it ...... Relational operators in C
Here's One diagram for you to learn the Relational Operators...
but even though you are able to understand the diagram then you will not get feel of it unless you see and example .. right people ???
Here 1 ... cherry on top ....
Example :
void main()
{
int price;
printf(" Enter price of the ice-cream : ");
scanf("%d",&price);
if( price > 20 )
{
printf("Let me Give you a Huge Cherry on TOP :) ");
}
}
on execution of this program if you enter price more than 20 then the if condition will execute and the statement will be printed on console.
Still not able to understand ?? .............. ok .... then for those who are still getting confused , I have one more li'l thing to share ... FLOW CHART ^^
Here's one of above example.....
Guess............. that should be enough for today .... but let me give you a very interesting exercise.
Can you write a program from a flow chart ??? ....... can you ?? ..just try it.
Here's a Flow chart
So long folks .......... Lets meet again and study :) .... ciao



It is a very nice blog. Really it is a very international destination post. Thanks for sharing this post.
ReplyDeleteWebsite development company