Marlabs interview question

Programming logic for prime numbers, swapping etc