The above code you have written is not the same as gi en in question. You can't write p++ in another line since p value will be used in the question is old one(1) nd the p value used in your code for computing q is new one(2). So, I think answer should be 3,2