#include<stdio.h>
int insertele(int n)
{
int a[1000] , pos, num , i , ele , p , q;
num = n;
printf(" Enter the %d arrayelements : ",n);
for(i=0 ; i<num ; i++)
{
scanf("%d",&a[i]);
}
printf(" \n Enter the position to be inserted :");
scanf("%d",&pos);
printf("\n Enter the values to be inserted ");
scanf("%d",&ele);
p = num-1;
q = pos-1;
for(i=p; i>=q ; i--)
a[i+1] = a[i];
a[pos-1] = ele;
printf(" \n The final arrayelement is :\t ");
for(i=0 ; i<=num ; i++)
{
printf("%d\t",a[i]);
}
return 0;
}
int main()
{
int n , x;
printf(" Enter the number of elements : \t ");
scanf("%d",&n);
x = insertele(n);
return 0;
}
OUTPUT : -
Follow
Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments