For loop to calculate an amount for a certain month period

According to the instructions,the user can enter a number of months and proceed to calculate the below. It should show up to the user as

Month 1: *amount*
Month 2: *amountx2* etc. (please refer to the below table for the repetitive pattern.

To maximize payments.

1st month's payment 1 dollar.
2nd month's payment 2 dollars. (doubled the amount)
3rd month's payment 6 dollars. (triple it every other months)
4th month's payment 12 dollars. (double the amount)
5th month's payment 36 dollars. (triple it every other month)
6th month's payment 72 dollars. (double the amount)
7th month's payment 216 dollars. (triple it every other month)
and so on ...

You can find my code below. The question that I have is how do I terminate the loop for the month counter and ensure that I have the correct value that doubles and triples accordingly? I've been trying for hours but I can't wrap my head around it. I would really appreciate any help. Thank you!

 ``123456789101112131415161718192021222324`` `````` #include using namespace std; int main() { cout << "***************************************************************************" << endl; cout << " Congratulations!!" << endl; cout << "If you are using this program that means you won the You-Are-Awesome Award!" << endl; cout << "***************************************************************************" << endl; cout << "I'm sure you are interested to know how much you have won, Let's calculate!" << endl; cout << "For how many months did they say that you will receive payments?" << endl; int Months; cin >> Months; for (Months = 1; Months<99999; Months++) { for (int NumMonths = 1; ; NumMonths++) { cout << "Month " << NumMonths << ": " << endl; } } system("pause");``````
You’ve been asked to create a loop which modify an integer value:
- every even iteration, the value must be multiply by 2
- every odd iteration, the value must be multiply by 3.

The sequence of instructions you need is more or less this:
- ask for a number (this number, the number of months, is the upper bound of your loop);
- display the result for the first month --> 1 (this is a special case, because it doesn't need to be multiplied);
- set a value to 1;
- loop from 2 to number of months;
---- if the iteration is ‘even’, multiply value x 2;
---- otherwise, multiply value x 3;
---- display result;
- end.

If you don’t know how to determine if the iteration is even or odd, you can ask again, but I guarantee you it’s not so hard to find out: the fact that every even number can be easily divided by 2 should remind you the way to achieve that.
Topic archived. No new replies allowed.