Besides the syntax errors, the only thing I see that is wrong with what you have is the types of the data do not agree. The array holds integers and the result is a double.
I try to avoid using literal values so I would define a constant value for the array size so your code could look something like this:
const int ArraySize = 2;
int data[ArraySize] = { 20, 5 };
int result = 15;
for( int i = 0; i < ArraySize; ++i )
{
result -= data[ i ];
}