cpp program to calculate simple interest using function c++

write a C++ program to input principle, rate, and time from the user and find the simple interest using the function. C++ | cpp program to calculate simple interest using function

Formula To calculate simple interest

Simple Interest = (p * n * r) / 100

where,

            p = Principal,

             n = Years

             r = Rate of Interest

example:-

              Principal Amount = ₹ 15000

              Period = 2 years

              Rate of Interest = 5%

              Simple Interest = ₹ 1500

Logic to calculate simple interest

Step

Input

  1. amount(principal) in P
  2. rate of interest in r
  3. time duration in t

use formula

si=(p*r*t)/100

print output

C++/cpp program to calculate simple interest without using function

#include<iostream>
using namespace std;
int main()
{
	int p,r,t,SI;
	cout<<"principle amount : ";
	cin>>p;
	cout<<"rate of interest : ";
	cin>>r;
	cout<<"time duration: ";
	cin>>t;
	SI=(p*r*t)/100;
	cout<<"Simple interest:-  "<<SI;
	return 0;
}
cpp program to calculate simple interest
output

C++/cpp program to calculate simple interest using function

#include<iostream>
using namespace std;
int Simple_interest(int,int,int);
int main()
{
	int p,r,t,SI;
	cout<<"Enter Principle : ";
	cin>>p;
	cout<<"Enter Rate : ";
	cin>>r;
	cout<<"Enter Time : ";
	cin>>t;
	SI=Simple_interest(p,r,t);
    cout<<"Simple interest is : "<<SI;
	return 0;
}
int Simple_interest(int p,int r,int t)
{
	int SI;
	SI=(p*r*t)/100;
	return SI;
}
cpp program to calculate simple interest using function
output

you may also like….

C program to calculate simple interest using function

java program to calculate simple interest using a function

c# program to calculate simple interest using function

python program to calculate simple interest using a function

Leave a Reply

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