// n - no.of elements in array // i - for traversing the array // j - location of the element to be deleted // a - Array #include<stdio.h> #include<conio.h> void main() { int a[30],n,i,j; printf("n Enter no of elements :"); scanf("%d",&n); /* read n elements in an array */ printf("n Enter %d elements :",n); for(i=0;i 〈 n;i++) scanf("%d",&a[i]); /* read the location of the element to be deleted */ printf("n location of the element to be deleted :"); scanf("%d",&j); /* loop for the deletion */ while(j 〈 n) { a[j-1]=a[j]; j++; } n--; /* no of elements reduced by 1 */ /* loop for printing */ for(i=0;i 〈 n;i++) printf("n %d",a[i]); ge
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
Subscribe to:
Post Comments (Atom)