You are on page 1of 2

Assignment=2 #include<stdio.h> #include<conio.

h> void main() { int array[100],pos,value,a,n; clrscr(); printf("enter the number of element\n"); scanf("%d",&n); printf("enter the %d element\n",n); for(a=0;a<n;a++) { scanf("%d",&array[a]); } for(a=0;a<n;a++) printf("%d",array[a]); printf("enter the position of element"); scanf("%d",&pos); printf("enter the value"); scanf("%d",&value); for(a=n-1;a>=pos-1;a--) { array[a+1]=array[a]; } array[pos-1]=value; printf("update array is:");

Assignment=2 for(a=0;a<n+1;a++) { printf("%d",array[a]); } getch(); }

enter the number of element 5 enter the 5 element 1 2 3 4 5 12345enter the position of element3 enter the value8 update array is:128345

You might also like