**1. 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 ).

- 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 ).

*>>so, first I have to initialize total to 0*

total = 0;

*>>then I don't know what to do to "read three values into amount, one at a time,"*

*>>After reading the values, total becomes*

total +=amount;

So, does the code altogether becomes

total=0;

(reading the value)

total+=amount;

?

2. Given that two int variables, total and amount , have been declared, write a loop that reads non-negative values into amount and adds them into total . The loop terminates when a value less than 0 is read into amount . Don't forget to initialize total to 0.

2. Given that two int variables, total and amount , have been declared, write a loop that reads non-negative values into amount and adds them into total . The loop terminates when a value less than 0 is read into amount . Don't forget to initialize total to 0.

This is the code I wrote which I know is not correct..

total =0;

for (amount = 1; amount > 0; amount++)

{

total +=amount

}

Please help me. ..I'm so confused..