Write a program in C to insert New value in the array (sorted list)



int main()


int n, p, i, len=9;

int arr[15]={12, 23, 45, 66, 69, 87, 95, 10, 106};

printf(“n  The array::”);

for(i=0; i<len; i++){

printf(”  %d  “,arr[i]);


printf(“nEnter the number you want to insert in array: “);


printf(“Enter the position in which you wanna insert the number: “);

scanf(“%d”, &p);


for(i=len; i>=p; i–){





printf(“nThe array after inserting the number:n”);

for(i=0; i<len; i++){

printf(”  %d  “,arr[i]);


return 0;


Leave a Reply

You cannot copy content of this page