Try declaring a variable outside of the loop, that will handle the sum. Let's say int sum = 0;. Initializing to 0 is very important, as you will build upon that zero.
So then after you enter the "CreditUnit" you could do: sum = sum + CreditUnit;. In the end if you output "sum" it will contain the sum of the CreditUnits that were entered. Simple. :)
Thank you @Sasauke for your effort to helping me.
I have done just that but it didn't work.
I entered:
2, 2, 3, 2, 2, 1 and instead of getting 12 as the sum total, I got 1.