How 'bout another "for" loop nesting from here:
Code:
		}
	}

	int result = array[0];
	for(i = 1; i < n; i++)
Of course maybe then you want to move the declaration up.