Can someone finish the code?

closed account (92w05Di1)
The question:

When equal amounts are invested in each of three accounts paying a1% a2% and a3% interest, one year's combined interest income is $S. How much is invested in each account?(Input a1, a2, a3and S. Calculate and output result)
Can someone just finish this code based on this question:



#include <iostream>
using namespace std;

int main()
{
int a1,a2,a3,s
cout << "Enter a1,a2, a3, s" << endl;
cin >>a1>>a2>>a3>>s;


system("pause");
return 0;
}
show us the mathematical steps.
closed account (92w05Di1)
Let x be the amount invested at 1%.

S = .01x + .02x + .03x

S = .06x

x = S / .06




Can someone please turn that into code and implement that into my program? thanks
 
cout << "x = " << (double)S/0.06;

Edit: oops, that was not correct i think; try this>
1
2
3
4
5
6
7
#include <iostream> 
int main()
{	double eqA, a1, a2, a3, S;
	std::cin >> a1 >> a2 >> a3 >> S;
	eqA = 100*S/(a1+a2+a3);
	std::cout << "result = " << eqA << '\n';
}
Last edited on
Topic archived. No new replies allowed.