C# has several number types. int holds whole numbers up to about 2.1 billion; long goes much further. double is binary floating point: fast and right for measurements, but 0.1 + 0.2 is not exactly 0.3. decimal stores base-10 digits exactly and is the type for money.
Integer division throws away the remainder: 7 / 2 is 3, and % gives the remainder, 1. To get 3.5, make one side fractional first: (double)7 / 2 or 7m / 2. Casting a result after the division is too late: (double)(7 / 2) is 3.0.
An int that goes past its maximum wraps around to a large negative number without an error unless the code is in a checked context. When a sum can get big, add into a long. Round on purpose with Math.Round, Math.Floor or Math.Ceiling, and know that a cast to int cuts toward zero.
Make one operand fractional before dividing, and widen to long before adding past int.MaxValue.