Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char entre[101];
  4.  
  5. int main()
  6. {
  7. int rotation, n;
  8. scanf("%d%d", &n, &rotation);
  9. scanf("%s", entre);
  10. printf("%c", entre[42]);
  11. if(rotation >= 0)
  12. {
  13. int i = n-rotation;
  14. for(; i<n; i++)
  15. printf("%c", entre[i]);
  16. i = 0;
  17. for(; i<(n-rotation); i++)
  18. printf("%c", entre[i]);
  19. }
  20.  
  21. else
  22. {
  23. int i = -rotation;
  24. for(; i<n; i++)
  25. printf("%c", entre[i]);
  26. for(i = 0; i<-rotation; i++)
  27. printf("%c", entre[i]);
  28. }
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement