How to convert the given array into zigzag pattern in c++

Published --