The idea of programming might sound like a frightening task, but don’t worry. We designed this blog so that you can get your feet wet without stepping into the deeper complexities of the programming.
This site is dedicated to all those people who want to learn the most basic but important Programming Language'C Programming'.
If done step wise C language is easy and fun to learn.
So lets get started.
Start reading from the First Post to understand C programming.You may read a desired topic from the labels.
One of the best methods to learn any programming language is to observe as much as programs you can , try editing them.
You can take a look at the various programs on this blog and feel free to ask if any doubts in with them.
Press Ctrl+D to add this page to your Favourites/Bookmarks for further reference.
Note:Your comments,queries and suggestions are welcome.Feel free to post them in the the comment boxes available after every post.

If you are interested in learning PHP, to create your own website or to spice up your existing website;here is the Best Tutorial available for PHP

Search C Programs,Compilers,Seminars ,Projects,etc.

Saturday, June 7, 2008

The if-else Statement

The if-else Statement

As described in earlier post,the if statement will execute a single statement, or a group of statements, when the expression following if evaluates to true.But it does nothing when the expression evaluates to false.
In case, we want to execute one group of statements if the expression evaluates to true and another group of
statements if the expression evaluates to false,we need to use the If-else statement.
The syntax of If-else statement is as follows;
if(condition)
{

statement;

}
else
{

statement2;

}

If the condition 1 is evaluated true,then statement1 will execute else statement2 will be executed.
A simple example is;

if(a=2500 )
{
hra = 1200;
da = basic * 0.5 ;pt=150;
}
else
{
hra = basic*0.1 ;
da = basic * 25.01 / 100 ;
}
gs = basic + hra + da ;
net=gs-pt;
printf ( "Net salary = Rs. %f", net ) ;
}

Monday, June 2, 2008

The IF statement

The IF statement

The C language uses the keyword if to implement the decision control instruction.
The general form of IF statement is as follows;
if ( condition )
execute this statement ;

The condition following the keyword if is always enclosed within a pair of parentheses. If the condition is true then the given statement is executed.If the condition is not true then the statement is not executed; instead the program skips past it. To express conditions in C we use conditional operators.






























ExpressionMeaning
x == yx is equal to y
x != yx is not equal to y
x <>
x is less than y
x > yx is greater than y
x <= yx is less than or equal to y
x >= yx is greater than or equal to y


Lets consider a sample program;

/* The IF statement */
main( )
{
int num ;
printf ( "Enter a number less than 50 " ) ;
scanf ( "%d", &num ) ;
if ( num <= 50 )
printf ( "You are fail" ) ;
}

On execution,if you enter a number less than equal to 50 you will get the message on the screen but if the number if greater than 50 you wont get any output.
There may be more than one IF statement in a program as per requiremant.

Sunday, June 1, 2008

Decision Control Structure

The Decision Control Structure

Till now we have used sequence control structure in the programs,in which the various steps are executed sequentially i.e.in the same order in which they appear in the program.
In C programing the instructions are executed sequentially,by default.
At times,we need a set of instructions to be executed in one situation and an another set of instructions to be executed in another situation.
In such cases we have to use decision control instructions.This can be acheived in C using;

(a)The if statement
(b)The if-else statement
(c)The conditional operators