Here in this program, we will calculate Compound Interest using the formula: CI = p(1+r/100) t Here CI = compound interest p= principal r= rate t= time
C++ Program to Calculate Compound Interest
#include<iostream.h>
#include< conio.h>
#include<math.h>
void main()
{
clrscr();
float CI,p,r,t;
cout<<"Enter the Principal value: ";
cin>>p;
cout<<"Enter the rate value: ";
cin>>r;
cout<<"Enter the time: ";
cin>>t;
CI = p*pow((1+(r/100)),t);
cout<<"The compound interest is: "<<CI;
getch();
}
Output:
Enter the Principal value: 30000
Enter the rate value: 20
Enter the time: 10
The compound interest is: 185752.0926719999
Python Program to Calculate Compound Interest
p = float(input("Enter the Principal value: "))
r= float(input("Enter the rate value: "))
t= float(input("Enter the time: "))
CI =p*((1+(r/100))**t)
print("The compound interest is:",CI)
Output:
Enter the Principal value: 20000
Enter the rate value: 3
Enter the time: 4
The compound interest is: 22510.1762
People are also reading:
- WAP to find quotient and remainder of two numbers
- WAP to Print the Following Pattern
- Python Program to Find the Factors of Number
- Python Program to Convert Decimal to Binary, Octal and Hexadecimal
- C Program to Design Love Calculator
- C Program to Convert Feet into Inches
- C Program to Extract a Portion of String
- WAP in C++ & Python & sort an Array Using Bubble Sort
- Python Program to Print Hello world!
- C++ and Python Code to Find The Sum of Elements Above and Below The Main Diagonal of a Matrix
Leave a Comment on this Post