C++ Program to Find Compound Interest

Here you will get a C++ program to find compound interest. The formula used to calculate compound interest is given below:

Compound Interest Formula

Image Source


using namespace std;

int main()
	float p,r,t,ci;
	cout<<"Enter Principle, Rate and Time:\n";
	ci=p*pow((1+r/100),t) - p;
	cout<<"\nCompound Interest = "<<ci;

	return 0;


Enter Principle, Rate and Time:
Compound Interest = 82.43

7 thoughts on “C++ Program to Find Compound Interest”

  1. well, sorry to say but ur formula is wrong…. ‘t’ is not an exponent of ‘p’…. we hav 2 take ‘p’ out side the pow function… hope u make necessary changes:)

  2. 11. Write C++ program to calculate the simple compound interest with necessary exception handling functions.(Consider 3 input parameters Amt, Time, Interest Rate, And output should be the total Amount after compounding. Program should give Exception message when input is not proper E.g. 3 12 only 2 parameter passed if, the Exception raised should be handled asking user to re-enter the input.)

  3. I’m not satisfied by your program beacause ypur formula is wrong….
    I hope you understand what I’m want to say….
    You will be change this necessary………..


      WAP a function to find the compound interest for the principal amount, no. of years and rate of interest entered by the user. Take rate of interest defaulted to 0.50 in case this value is not entered by user.

      Please solve this sambit Sworup Rout

Leave a Comment

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