Program to find
Simple Interest Using function with Parameters and Returning
a Value
Program
#include
<stdio.h>
void main()
{
int p, t;
float r;
float
SimpleInterest(int p, int t, float r);
printf("\nEnter
the Principle Amount, Term, Rate of Interest : ");
scanf("%d%d%f",
&p, &t, &r);
printf("\nThe
Simple Interest for the Principle Amount %d for %d Years with an
Interest of
%0.2f", p, t, r);
printf("\n is
%f.", SimpleInterest(p, t, r));
}
float
SimpleInterest(int p, int t, float r)
{
return((p * t * r) /
100);
}
No comments:
Post a Comment