Oh, you made a serious effort. Lots of ways to do it of course. (BTW, NEVER use sum as a variable name!!!!!)
X = pi/2;
N = [3 10 25];
n = 1:max(N);
seriesterms = (((-1).^n)./n).*sin(n*X)
partialsums = cumsum(seriesterms);
partialsums = partialsums(N);
So no explicit loop there. Since you used sum, I assume cumsum is equally valid to use. ;-) Anyway, you never said cumsum was disallowed.
There is nothing wrong with use of a loop of course.