Chapter:

Arrays-

Write a program in C to insert New value in array.

Write a program in C to insert New value in the array.

#include <stdio.h>
void main()
{
   int arr1[100],i,n,p,x;
   printf("\n\nInsert New value in the unsorted array : \n ");
   printf("-----------------------------------------\n");   
   printf("Input the size of array : ");
   fflush(stdout);
   scanf("%d", &n);
    /* Stored values into the array*/
   printf("Input %d elements in the array in ascending order:\n",n);
    for(i=0;i<n;i++)
         {
	       printf("element - %d : ",i);
	       fflush(stdout);
	       scanf("%d",&arr1[i]);
	    }
   printf("Input the value to be inserted : ");
   fflush(stdout);
   scanf("%d",&x);
   printf("Input the Position, where the value to be inserted :");
   fflush(stdout);
   scanf("%d",&p);
   printf("The current list of the array :\n");
   for(i=0;i<n;i++)
     {
     	 printf("% 5d....
Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-