While loop implemented