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”.