EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+

Write a program to delete the given element which may be present at any position from the given array

Source Code

int main (int argc, char *argv[])
  int ar[100];
  int r,p,i;
10      ar[i]=0;
11    }
12    printf("\n Enter the range of the array:(less than 100) ");
13    scanf("%d",&r);
14    printf("\n Enter the elements of the array:");
15    for(i=0;i<r;i++)
16    {
17         printf("\n Enter element number: %d ",(i+1));
18         scanf("%d",&ar[i]);
19    }
20    printf("\n Enter the position where element is to be deleted:");
21    scanf("%d",&p);
22    for(i=p-1;i<r;i++)
23    {
24          ar[i]=ar[i+1];
25    }
26    printf("\n The Elements of array are:");
27    for(i=0;i<r-1;i++)
28    {
29      printf("%d ",ar[i]);
30    }
31    getch();
32  }

Find More from our code collection
Armstrong number, binary number to a decimal number, bubble sort, decimal number to binary number, factorial of the given number factors, fibonacci numbers, HCF and LCM, matrix, mergesort, salary of the employee. palindrome, quadratic equation, star patterns, series etc. and much more...
#Return to Example Source Code