0
This code giving me error, Im suppose to calculate compound interest. Kindly help me
#include <iostream> #include <math.h> using namespace std; int main() { float principal,rate,time,compound_interest,; cout << " Enter principal Amount "; cin>>principal; cout << " Enter Rate "; cin>>rate; cout << " Enter Time period in years "; cin>>time; compound_interest=Principal*pow((1+rate/100),time)-principal; cout<< "The compound interest after compounded for the amount "<<principal<<" for "<<time<<" years at "<<rate<<" % is "<<compound_interest; return 0; }
6 Answers
+ 3
Bismark Abban you should remove ,(comma) after compound_interest (before Cout<<"Enter principal amount ")
And (below cin>>time) line change principal (capital P to small p)
+ 2
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float principal,rate,time,compound_interest;
cout << " Enter principal Amount ";
cin>>principal;
cout << " Enter Rate ";
cin>>rate;
cout << " Enter Time period in years ";
cin>>time;
compound_interest=principal*pow((1+rate/100),time)-principal;
cout<< "The compound interest after compounded for the amount "<<principal<<" for "<<time<<" years at "<<rate<<" % is "<<compound_interest;
return 0;
}
+ 1
Bismark Abban you have used char datatype so it takes only first character from input
Use string instead of char
0
thank you very much.. it worked
0
kindly check on this one for me also please
#include <iostream>
using namespace std;
int main()
{
char Fname,Lname,email,address,contact;
cout << "Enter your First name ";
cin>>Fname;
cout << "Enter your Last name ";
cin>>Lname;
cout << "Enter your email ";
cin>>email;
cout << "Enter your address ";
cin>>address;
cout << "Enter your contact ";
cin>>contact;
cout << "Your full name is "<<Fname<<" "<<Lname<<" with an email address "<<email<<"with address "<<address<<"and your contact number is "<<contact<<endl;
return 0;
}
0
ok... but please after using it doesnt give the user the space to enter his address. Address and contact are combined. it doesn't show on separate line