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.

Monday, August 30, 2010

A C program to print the average of the numbers(Using While Loop)

Below is a program to print the average of two numbers that are input through the keyboard. 
/* Read the numbers from the keyboard as input and
 * print out their average as output.  */ 
#include &lt stdio &gt
int main( )
   double x = 0.0, sum = 0.0;
   int count = 0;

   printf( "\t--- Calculate Average of the numbers ---\n" );
   printf( "\nEnter the number you want to calulate average for:\n"
           "(Type a letter to end your input)\n" );
   while ( scanf( "%lf", &x ) == 1 )
      sum += x;
   if ( count == 0 )
     printf( "No input data given!\n" );
     printf( "The average of given numbers is %.2f\n", sum/count );
   return 0;
The output of the program: