-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray2.c
More file actions
33 lines (33 loc) · 742 Bytes
/
Copy pathArray2.c
File metadata and controls
33 lines (33 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
void main()
{
int a[50],n=3,i,loc,m;
int b[3];
printf("Enter the size:");
scanf("%d",&m);
printf("Enter the %d elements:",m);
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the location(0 to %d) to insert:",m);
scanf("%d",&loc);
printf("Enter the %d elements to insert:",n);
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
}
for(i=m-1;i>=loc;i--)
{
a[i+n]=a[i];
}
for(i=0;i<n;i++)
{
a[loc+i]=b[i];
}
printf("Array after insertion:\n");
for(i=0;i<m+n;i++)
{
printf(" %d",a[i]);
}
}