Please check my approach it is giving answer as expected but some boundary cases are missed
output has #t th value not the value we input
so it ll be 1 2 3 till t
here is your corrected code:
if this solves your doubt please mark it as resolved
Thank you It worked now