-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_Data_Insert.c
More file actions
40 lines (37 loc) · 833 Bytes
/
Array_Data_Insert.c
File metadata and controls
40 lines (37 loc) · 833 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
34
35
36
37
38
39
40
/*
Author : Simanta Kumar Roy
Daffodil International University
221-35-909
roy35-909@diu.edu.bd
*/
#include<stdio.h>
int main()
{
int i,n;
printf("Enter a Array size :");
scanf("%d",&n);
int a[n+n];
printf("Enter %d numbers for an array\n",n);
for(int i=0;i<n;i++)
{
printf("Enter [%d] Index value for this array : ",i);
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++)
printf("%d ",a[i]);
for(int u=0;u<2;u++)
{
printf("\nType a index and value for insert : ");
int new_index,new_value,temp;
scanf("%d %d",&new_index,&new_value);
n+=1;
for(int i=new_index;i<n;i++)
{
temp = a[i];
a[i] = new_value;
new_value = temp;
}
for(int i=0;i<n;i++)
printf("%d ",a[i]);
}
}