You're guessing without understanding. You can't code that way. I know you're under a deadline, but you don't seem to understand why you're doing what you're doing. You either want a j loop, or you want the second index hardwired, but not both, depending on whether you want to sum one column or multiple.