Ya..Now I understand.I forgot to write the constant of integration in the answer.It can have both the answers and in fact any no. of answers bcoz an indefinite integral has any no. of answers depending on the constant c.
Here,The answer is tan2x/2+c=tan2x+1/2+c-1/2=sec2x/2+c' where c'=c-1/2.
So,both the answers are correct.Sorry for not telling this earlier.It didn't strike to my mind that time.
MAKING A MISTAKE IS HUMAN BUT REPEATING IT IS IDIOTIC.