• Without while loop can we do this?

    since loop is taking more time any other alternate method

    Thanks!