aiNayan

4

Feb 17th, 2021 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int n, p, i, count = 1;
  5. printf("Enter the number of elements: ");
  6. scanf("%d", &n);
  7. int a[n];
  8. printf("Enter the numbers: ");
  9. for (i = 1; i <= n; i++)
  10. scanf("%d", &a[i]);
  11. printf("Enter the pivot value: ");
  12. scanf("%d", &p);
  13. for (i = 1; a[i] != p; i++)
  14. count++;
  15. for (i = count - 1; i != 0; i--)
  16. printf("%d ", a[i]);
  17. printf("%d ", p);
  18. for (i = n; i != count; i--)
  19. printf("%d ", a[i]);
  20. return 0;
  21. }
Add Comment
Please, Sign In to add comment