Computer Science, asked by bhongvaibhav, 19 hours ago

write a C program to accept principal rate of interest and number of year. compute simple interest​

Answers

Answered by mohitbkn25
0

Answer:

include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

float simpleInterest(int ,int , float);

float compoundInterest(int ,int , float);

int p,t;

float r,s,c;

clrscr();

printf("Enter P,T,R :\n");

scanf("%d%d%f",&p,&t,&r);

s=simpleInterest(p,t,r);

c=compoundInterest(p,t,r);

printf("Simple interest = %9.2f\n",s);

printf("Compound interest = %9.2f\n",c);

getch();

}

float simpleInterest(int p,int t , float r)

{

return((p*t*r)/100.0);

}

float compoundInterest(int p ,int t, float r)

{

return(p*pow((1+r/100),t)-p);

}

Sample Output:

Enter P, T, R:

1234

23

2

Simple Interest = 567.64

Compound Interest = 711.89

Hope This would help you.

Thank You :)

Similar questions