First of all ^ does not do what you think it does, its an exclusive or logical operator, not power, you want to include cmath and use pow for that.
Second, I'd be amazed if you could even tell me in english what that code does. Any good compiler would complain that index at lines x y and z will never be 10, 20, 30, 40, or 50, a clue right there that your printing is notpart of your looping calculation.
First, do your calculations which looks like you want to square the index and store it into the first 25 elements, then multiples of 3 on the index for the remaining 25 (two seperate loops)
THEN, do your print out code, which we already gave you tips on in other comments