Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n, p, i, count = 1;
- printf("Enter the number of elements: ");
- scanf("%d", &n);
- int a[n];
- printf("Enter the numbers: ");
- for (i = 1; i <= n; i++)
- scanf("%d", &a[i]);
- printf("Enter the pivot value: ");
- scanf("%d", &p);
- for (i = 1; a[i] != p; i++)
- count++;
- for (i = count - 1; i != 0; i--)
- printf("%d ", a[i]);
- printf("%d ", p);
- for (i = n; i != count; i--)
- printf("%d ", a[i]);
- return 0;
- }
Add Comment
Please, Sign In to add comment