Write a C program to shift elements of an array by n positions or rotate the array elements n times.…