Computer Science, asked by Diamond7640, 1 year ago

Write a program to calculate simple intrest using function in c++

Answers

Answered by hetanshusonar
2
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

amount(principal) in P
rate of interest in r
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;
}


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;
}



I HOPE THIS HELPS U....
THANK U....
Similar questions