1

Cyclic Right Shift of Elements (Id-1243)

Just for Practice 1 Additional [3-Jan-2018 to 10-Apr-2018]

Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]

Program ID- 1243

 

Given a set of elements stored in an array and a number ‘m’, design an Algorithm and write the subsequent C program to perform cyclic right shift of the array by ‘m’ places. For example, if the elements are 12, 13, 16, 7, 10 and m =2 then the resultant set will be 7, 10, 12, 13, 16.

Input Format:

Number of elements in the set: ‘n’

element-1

element-2

element-n

value of ‘m’

Output Format:

Elements in the set after right shift by ‘m’ places.

Code

Please Comment Working if the code worked to you

If you have other working codes please comment the codes enclosing with <pre> and </pre> 🙂

Example: <pre> Your Code </pre>

C Code [By Chir Patel]

Follow for important news/announcements in VIT

C Code [By Mounish Sai]

C++ Code [By Mounish Sai]

The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.

 

Click Here to Leave a Comment Below 1 comments
raj - August 22, 2020

l=[12,13,16,7,10]
n=2
for i in range(0,2):
popp=l.pop()
l.insert(0,popp)
print(l)

Reply

Leave a Reply:

This site uses cookies and by using the site you are consenting to this.