This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Madhuban Khatri
Interest calculator System in C++
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
float simple_interest(float a, float b, int c){
float si = (a*b*c)/100;
return si;
}
float compound_interest(float x, float y, int z){
float ci = x*pow((1+y/100),z)-x;
return ci;
}
int main(){
float p, r;
int t;
string m;
cout<<"Enter your Principal Amount: ";
cin>>p;
cout<<"Enter your Rate of Interest: ";
cin>>r;
cout<<"Enter your Time: ";
cin>>t;
cout<<"****************"<<endl;
cout<<"Type of Interest(s for SI and c for CI): ";
cin>>m;
if(m=="c"){
cout<<"Compound Interest is: "<<compound_interest(p,r,t);
}
else if(m=="s"){
cout<<"Simple Interest is: "<<simple_interest(p,r,t);
}
else{
cout<<"Please select between SI & CI";
};
return 0;
}
This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Madhuban Khatri
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Madhuban Khatri | Sciencx (2022-09-25T08:13:03+00:00) Interest Calculator In C++. Retrieved from https://www.scien.cx/2022/09/25/interest-calculator-in-c/
" » Interest Calculator In C++." Madhuban Khatri | Sciencx - Sunday September 25, 2022, https://www.scien.cx/2022/09/25/interest-calculator-in-c/
HARVARDMadhuban Khatri | Sciencx Sunday September 25, 2022 » Interest Calculator In C++., viewed ,<https://www.scien.cx/2022/09/25/interest-calculator-in-c/>
VANCOUVERMadhuban Khatri | Sciencx - » Interest Calculator In C++. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/09/25/interest-calculator-in-c/
CHICAGO" » Interest Calculator In C++." Madhuban Khatri | Sciencx - Accessed . https://www.scien.cx/2022/09/25/interest-calculator-in-c/
IEEE" » Interest Calculator In C++." Madhuban Khatri | Sciencx [Online]. Available: https://www.scien.cx/2022/09/25/interest-calculator-in-c/. [Accessed: ]
rf:citation » Interest Calculator In C++ | Madhuban Khatri | Sciencx | https://www.scien.cx/2022/09/25/interest-calculator-in-c/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.