#include <stdio.h>
int main()
{
int array[100], pos, c, n, value;
printf("Enter number of elements in array\n");
scanf("%d", &n);
printf("Enter %d elements\n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
printf("Enter the location where you wish to insert an element\n");
scanf("%d", &pos);
printf("Enter the value to insert\n");
scanf("%d", &value);
for (c = n - 1; c >= pos - 1; c--)
array[c+1] = array[c];
array[pos-1] = value;
printf("Resultant array is\n");
for (c = 0; c <= n; c++)
printf("%d\n", array[c]);
return 0;
}
OUTPUT :-
For
Other Programs Visit The WebSite:- https://www.techapurba.com/
Follow
Me On Social Media :-
Instagram
link :- https://www.instagram.com/apurba_khanra/
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments