Saturday, October 8, 2011

C program to find Compound Interest using functions


Write a program to display Compound Interest for a given principal amount for 1 yr. Use function to find the interest....



Program..

#include<stdio.h>
#include<conio.h>
float ci(int p,float r);
void main()
{
int p;
float r,i;
clrscr();
printf("Enter the pricipal amount to find the compound interest of:");
scanf("%d",&p);
printf("\nEnter the rate:(r/100)");
scanf("%f",&r);
i=ci(p,r);
printf("\nThe interest for 1 yr: %f",i);
getch();
}

float ci(int p, float r)
{
float i;
i=(p*(1+r))-p;
return i;
}


Output...


0 comments:

Post a Comment

Search on this blog

Loading...

About Me