by Dinesh Thakur Category: Array
#include <stdio.h>

#include <conio.h>
int main()
{
    int i, n, j, num, arr [10];
    clrscr ();
    printf("\n Enter the number of elementsin the array : " );
    scanf(" %d" , &n);
  for(i=0;i<n;i++)
  {
    scanf("%d", &arr[i]);
  }
    printf("\n Enter the number to be deleted: ");
    scanf("%d", &num);
  for(i=0;i<n;j++)
  {
    if(arr[i]==num)
    {
      for(j=i;j<n;j++)
      {
         arr[j] = arr[j+1];
      }
    }
       printf("\n The array after deletion is:");
         for(i=0;i<n-1;i++)
         {
             printf("\t%d",arr[i]);
         }
            getch();
  }
        return 0;
}

delete a number from an array that is already sorted in ascending order



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles