text: Print array after it is right rotated K times | C # implementation of right rotation of an array K number of times ; Function to rightRotate array ; If rotation is greater than size of array ; Printing rightmost kth elements ; Prints array after ' k ' elements ; Driver code
code: using System ; class GFG { static void RightRotate ( int [ ] a , int n , int k ) { k = k % n ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < k ) { Console . Write ( a [ n + i - k ] + " ▁ " ) ; } else { Console . Write ( a [ i - k ] + " ▁ " ) ; } } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int [ ] Array = { 1 , 2 , 3 , 4 , 5 } ; int N = Array . Length ; int K = 2 ; RightRotate ( Array , N , K ) ; } }