Given that two int variables, total and amount , have been declared, write a sequence of statements that:
initializes total to 0
reads three values into amount , one at a time.
After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ).
__
I have no idea what I'm doing wrong and other options I could do
this is what i have:
total = 0;
amount = 0;
while (amount <3)
{
cin >> amount;
total += amount;
}
initializes total to 0
reads three values into amount , one at a time.
After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ).
__
I have no idea what I'm doing wrong and other options I could do
this is what i have:
total = 0;
amount = 0;
while (amount <3)
{
cin >> amount;
total += amount;
}
Comment