As in question is given , this pattern is positive odd nos

what should we do in the code for other inputs other than positive odd nos.?

all the test cases will have positive odd nos only ,dont worry about that