If you observe PARTITION of the array algorithm carefully then you'll observe at line 4 i.e. in
$if A[j]\leq x$
simply the change it to $\leqslant$ which is
$if A[j]\geqslant x$
this will make all the elements greater than pivot move to the left of the array and rest to the right which is the desired result.