Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int insert(int n, int a[], int position)
- {
- int j;
- for(j=n;j>=position;j--){
- a[j+1]=a[j];
- }
- scanf("%d", &a[position]);
- for(j=0;j<=n;j++){
- printf("%d ", a[j]);
- }
- printf("\n");
- }
- int main()
- {
- int i, n;
- int position;
- int a[1000];
- scanf("%d", &n);
- for(i=0;i<n;i++)
- scanf("%d", &a[i]);
- scanf("%d", &position);
- position--;
- insert(n,a,position);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment