help with storing the last value of a loop and adding it?

This is a discussion on help with storing the last value of a loop and adding it? within the C Programming forums, part of the General Programming Boards category; I am currently working on a homework assignment I am having a hard time adding the last value from a ...

I have everything I need but there is just one thing that I can't figure out and it's how to get the over all number in deposit and checks cashed . Meaning adding all the deposits , like if my first deposit was 144.35 then the next one is 166.88 I have to add them.

how stupid of me I accidently erased something front the top sorry guys

the assignment I am doing is a checking account which gets the inputs from an external source ( and txt file) the txt file has a starting character which Id's what type of transaction
( I = initial Balance , D = Deposit , C = Checks cashed) . and then is has the number either depositing or taking away.

Example of txt file :

I 498.98
D 866.79
C 289.98

what the professor wants us to do is to make a monthly statement and produce a list of the transactions and the balance of the account

also wants us to output the how many deposits and check cashed , also to total how much money was deposited and taking away.

Where I am having trouble is in adding all the values from Deposit and check cashed the while loops the code and the amount. I got the initial balance taking care of but just adding up all the values in deposit and checks cashed to get the amount