Financial application c++ program
savings account with the annual interest rate 5%. Thus, the monthly interest rate is
0.05/12 = 0.00417. After the first month, the value in the account becomes
100 * (1 + 0.00417) = 100.417
After the second month, the value in the account becomes
(100 + 100.417) * (1 + 0.00417) = 201.252
After the third month, the value in the account becomes
(100 + 201.252) * (1 + 0.00417) = 302.507
and so on.
Write a program that prompts the user to enter a monthly saving amount and displays
the account value after the sixth month
#Beginner
In gcc c++ compiler using namespace std;
#include<iostream>
using namespace std;
int main()
{
float amount,total=0;
cout<<"Enter te monthly saving amount $ :";
cin>>amount;
total=amount*(1+0.00417);//1st
total=(amount+total)*(1+0.00417);//2nd
total=(amount+total)*(1+0.00417);//3rd
total=(amount+total)*(1+0.00417);//4th
total=(amount+total)*(1+0.00417);//5th
total=(amount+total)*(1+0.00417);//6th
cout<<"After the sixth month,te account value is $"<<total;
return 0;
}
Output
Enter te monthly saving amount $ :100
After the sixth month,te account value is $608.818
[Program finished]
Comments
Post a Comment
Any doubt about programming or questions