using while loop