#include<stdio.h>
#include<conio.h>
int main()
{
int a[50],pos,number,i,n;
clrscr();
printf("Enter size of Array:");
scanf("%d",&n);
printf("Enter %d elements in Array:\n",n);
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
printf("Enter position where you want to insert element:");
scanf("%d",&pos);
printf("Enter value which you want to insert in Array:");
scanf("%d",&number);
for(i=n-1; i>=pos; i--)
{
a[i+1]=a[i];
}
a[pos]=number;
printf("After inserting value ,Array is:");
for(i=0; i<n+1; i++)
{
printf("\n%d",a[i]);
}
return 0;
}
*** Input && Output ***
0 Comments