Rotation array element(Left to right)

 public class RotaionArray {

    public static void main(String[] args) {

        

    

    int A[]= {1,2,3,4,5,6,7,8,9,10};

    int temp=A[9];

    for(int x:A)

        System.out.print(x+”,”);

        System.out.println(“”);

         

    for(int i=8;i>-1;i–){

         A[i+1]=A[i];  

      }

    A[0]=temp;

    for(int x:A)

        System.out.print(x+”,”);

        System.out.println(“”);

        

    }

    

}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top