C program to calculate compound interest

list of programs below: C program to calculate compound interest using functions, C program to calculate compound interest without functions,
c program to calculate total amount after compound interest.

Compound interest arises when interest is added to the principal, so that from that moment on, the interest that has been added also earns interest. This addition of interest to the principal is called compounding.

For Rs. 5000 at interest rate 10% every year, Amount with compound interest at end of first year is 5500. Amount with compound interest at end of second year is 6050 (5000 Amt + 500 first year interest + 500 second year interest+ 50 [interest on interest of first year]) and at end of third year Amount with compound interest is 5000 + 500 x 3 + 50 x 2 + 50 + 5 = Rs. 6655

note: compound interest generated for first period of time ( year as per above example) is always equal to simple interest for first period of time. From second period onwards compound interest varies as interest on interest adds up.

C program to calculate compound interest using functions without functions
C program to calculate compound interest using functions without functions

Write a C program to calculate compound interest using functions

write a C program to find compound interest using functions / write a C program for calculating compound interest using functions

#include<stdio.h>
#include<conio.h>
// math.h has mathematical functions
#include<math.h>
void main()
{
float p,t,r;
float i, compound;
clrscr();
printf(“…To calculate compound interest…..\t”)
printf(“Enter principal:\t”);
scanf(“%d”,&p);
printf(“Input rate of interest:\t”);
scanf(“%d”,&r);
printf(“Enter time in years:\t”);
scanf(“%d”,&t);
if((principal<1)||(time<1)||(rate<1))
{
printf(“invalid”);
}
else
{
compound = ci( p, t, r );
printf(“the compound interest is rs.%.2f”, compound);
}
}

float ci( int principal, int rate, int time)
{
int amount=(float)principal*(pow(1+rate/100.0,time));
return(amount-principal);
}

OUTPUT:
To calculate compound interest
Enter principal: 200
Input rate of interest: 10
Enter time in years: 1
The compound interest is rs. 20

write a C program to find compound interest without functions

write a C program to calculate compound interest without functions / write a C program for calculating compound interest without functions

#include<stdio.h>
#include<conio.h>
// math.h has mathematical functions
#include<math.h>
void main()
{
float p,t,r;
float i,compound,a;
clrscr();
printf(“…To calculate compound interest…..\t”)
printf(“Enter principal:\t”);
scanf(“%d”,&p);
printf(“Input rate of interest:\t”);
scanf(“%d”,&r);
printf(“Enter time in years:\t”);
scanf(“%d”,&t);
if((p<1)||(t<1)||(r<1))
printf(“invalid”);
else
{
a=(float)p*(pow(1+r/100.0,t));
compound=a-p;
printf(“The compound interest is rs.%.2f”,compound);
}
getch();
}

OUTPUT:

…To calculate compound interest…..
Enter principal: 100
Input Rate of interest: 10
Enter time in years: 2
The compound interest is rs. 21

write a c program to find Total Amount (A) to be paid, at end of time period (T),  for a Rate of Interest (R) and Prinipal amount (P)  for debt taken on compound interest

write a c program to find Total Amount (A) to be paid, at end of time period (T),  for a Rate of Interest (R) and Prinipal amount (P)  for debt taken on compound interest

#include<stdio.h>
#include<conio.h>
// math.h has mathematical functions
#include<math.h>
void main()
{
float p,t,r;
float i,  a;
clrscr();
printf(“…To calculate compound interest…..\t”)
printf(“Enter principal:\t”);
scanf(“%d”,&p);
printf(“Input rate of interest:\t”);
scanf(“%d”,&r);
printf(“Enter time in years:\t”);
scanf(“%d”,&t);
if((p<1)||(t<1)||(r<1))
{
printf(“invalid input”);
}
else
{
a = Total _Amt_CI( p, r, t );
printf(“The Total amount to be paid is %.2f”, a);
}
}
//funtion for Total amt after compount interest

Total _Amt_CI( float prin, int rate, int time)
{
float amt=(float)prin*(pow(1+rate/100,time));
return amt;
}
}

Other programs:

Static variable scope
Register variable scope
External variable scope
Automatic variable scope
amicable number
Prime number
Perfect number
Palindrome number
Strong number
Find Factorial 
Biggest Number
Average of n numbers
convert decimal number to octal
decimal number to hexadecimal
decimal number to binary
simple interest
compound interest
Add sparce matrices
Add matrices
 file copying
Palindrome string
Reverse string
String length
Replace characters in string
substring or not using arrays
First occurrence of character in string
Last occurrence of character in string
Convert to uppercase
Convert to lowercase
Concatenate strings 
Compare strings
Generate Employee payslips
Count students scoring marks>50%
convert weight into grams

 

Leave a Reply

Your email address will not be published. Required fields are marked *