0% found this document useful (0 votes)
310 views1 page

Simple & Compound Interest C Code PDF

This C program calculates simple and compound interest. It prompts the user to input the principal amount, interest rate, and number of years. It then uses the input values to calculate simple interest by multiplying principal, rate, and time. For compound interest, it calculates the compounding factor, raises it to the power of number of years, multiplies it by the principal, and subtracts the principal to determine the interest amount. The results of both simple and compound interest calculations are then printed.

Uploaded by

Amit Maurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
310 views1 page

Simple & Compound Interest C Code PDF

This C program calculates simple and compound interest. It prompts the user to input the principal amount, interest rate, and number of years. It then uses the input values to calculate simple interest by multiplying principal, rate, and time. For compound interest, it calculates the compounding factor, raises it to the power of number of years, multiplies it by the principal, and subtracts the principal to determine the interest amount. The results of both simple and compound interest calculations are then printed.

Uploaded by

Amit Maurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

EXP 1: C-Program to calculate simple and compound interest

#include<stdio.h>
#include<math.h>
int main()
{
float p,q,r,SI,CI;
int n;
printf("Enter the value of Principal p = ");
scanf("%f",&p);
printf("Enter the value of Rate r = ");
scanf("%f",&r);
printf("Enter the value of Period in year n = ");
scanf("%d",&n);
SI = ((p*r*n)/100);
printf("Simple Interest SI=%f \n",SI);
q = 1+(r/100);
CI=p*pow(q,n)-p;
printf("Compound Interest CI=%f \n",CI);
return 0;
}

Page 2 of 27

You might also like