program in C to delete an number from an array
NOTE : In this source code the element of array are not deleting in really from array.
#include<stdio.h> #include<conio.h> void main() { int i,a[20],n,c=0,d; clrscr(); printf("Enter number of elements you want to insert:-"); scanf("%d",&n); printf("Enter %d numbers:-",n); for(i=0;i<n;i++) scanf("%d",&a[i]); printf("Enter delete Number:-"); scanf("%d",&d); for(i=0;i<n;i++) { if(a[i]==d) c++; } if(c>=1) { for(i=0;i<n;i++) { if(a[i]==d) continue; else printf("%3d",a[i]); } } else printf("%d is not present in entered array.",d); getch(); }
Output:-
Related Programs
0 Comments