Assignments » Library Function » Set1 » Solution 1

Write a program which input principal, rate and time from user and calculate compound interest.

CI = P(1+R/100)T - P

#include<iostream.h>
#include<conio.h>
#include<math.h>

int main()
{
	float P,R,T,CI;
	cout<<"Enter Principal, Rate and Time : ";
	cin>>P>>R>>T;
	CI=P*pow((1+R/100),T) - P;
	cout<<"Compound Interest is : "<<CI;
	getch();
	return 0;
}
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	float P,R,T,CI;
	cout<<"Enter Principal, Rate and Time : ";
	cin>>P>>R>>T;
	CI=P*pow((1+R/100),T) - P;
	cout<<"Compound Interest is : "<<CI;
    
	return 0;
}

Enter Principal, Rate and Time : 4500 6.5 3
Compound Interest is : 935.774

 

«back