Tuesday, 26 March 2019

C Program to Find Simple Interest and Compound Interest

Write a C Program to Find Simple Interest and Compund Interest

C program to find simple interest and compound interest


In this C Program, we have to calculate simple and compound interest using their formula. The principal amount, rate of interest and time will be given by the user.

How to code this C Program ?


First let's discuss about simple interest and compund interest. 
Formula for simple interest is given by

        SI(simple interest)= (P*R*T)/100

Formula for compound is given by

        CI(compund interest)= P*(1+R/100)^T

In the above formula,

P= Principal Amount
R= Rate Of Interest
T= Time period

which will be entered by the user.


Code For the C Program to Find Simple and Compund Interest


#include<stdio.h>
#include<conio.h>
#include<math.h>
  
void main()
{
    float P,R,T,SI,CI;
    printf(" Enter principal amount, time, rate of interest \n");
    scanf("%f%f%f",&P,&T,&R);
    SI=(P*R*T)/100;
    CI=P*pow((1+(R/100)),T); 
    printf("The Simple Interest is %f and Compund Interest is %f ",SI,CI);
    getch();
}


Output Of The C Program

Input: P=1500, R=5, T=3
Output: SI=225, CI=1736.44
 

No comments:

Post a Comment