Calculate simple interest using a function .

#include <stdio.h>

float calcsi(float principle, int years, float interest);

int main(void)
{
float p, r, si;
int n;

printf("\nEnter values for principle, years and interest : ");
scanf("%f%d%f", &p, &n, &r);

si = calcsi(p, n, r);

printf("\nSimple Interest = %f", si);

return 0;
}

float calcsi(float principle, int years, float interest)
{
float si;
si = (principle * years * interest) / 100;
return si;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin