Enter your email address:

Delivered by FeedBurner

Tuesday, December 28, 2010

First C Sample Program

Let us now write down our first C program.

/*calculation of simple interest*/
/*my first c program*/

#include <stdio.h>
int main()
{
    int p,n;          /* declaration*/
   float r,si;       /* declaration*/

   p=1000;
   n=3;
   r=8.5;
    /*formula for simple interest*/
   si=p*n*r/100;     /* usage*/

   printf("%f",si);
   return 0;
}

C does not contains any instructions to display output on the screen. All the output to screen is achived using readymade library functions. One such functions is “printf()”. we have used it display on the screen the values contained in “si”.

6 comments:

  1. coach purses infuse a royal quality to the inimitable modern fashion charm, and build an impeccable bag for all ladies to keep stylish and gorgeous in their everyday look. coach outlet online supplies a wonderful series of coach bags including totes, crossbody bags and wallets. You can get adorable items, enjoyable discount and convenient free shipping here!

    ReplyDelete
  2. Thats an very nice tutorial. I would wish to share an C Programming tutorial as well @ http://www.codersyard.com/thread/viewTopic?thread=26. Hope this was useful.

    ReplyDelete
  3. It’s really a very awesome content. You have done an very good job. express gratitude you so much for discussing
    FIN 370 Week 3

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...