Wednesday, September 5, 2012

C language program examples


Write a C program to input amount, rate of interest and number of years from user, and calculate simple interest.

 (SI = P*R*N/100) 



#include<stdio.h>
#include<conio.h>
void main()
{
         float p,r,n,si;
         clrscr();
printf("\nEnter the principle=>");
scanf("%f",&p);
 

         printf("\nEnter the rate=>");
scanf("%f",&r);
 

         printf("\nEnter the number of years=>");
scanf("%f",&n);
 

         si=p*r*n/100;
printf("simple interest is =%.3f",si);
         getch();
}


2 comments: