// program to.. #include <stdio.h> #include <stdlib.h> int main() { //No.9 int a[50],n,i,b,d=0,j,temp; printf("Enter how many numbers you want to enter in you array: "); scanf("%d",&n); for (i=0;i<n;i++) { printf("Enter No.%d: ",i+1); scanf("%d",&a[i]); } printf("Enter which number you want to delete: "); scanf("%d",&b); for(i=0;i<n;i++) { if (b==a[i]) { while (a[i]==b) { a[i]=0; for (j=i;j<n-1;j++) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } } printf("Your new array is: \n"); for (i=0;i<n;i++) { printf("Enter No.%d: %d\n",i+1,a[i]); } getch(); return 0; }
C and C++ programs, games, softwares. Easy programming guide. Learn to code and enjoy coding in CoderNepal
Home » C Programs
C Programs
C Programs
Subscribe to:
Posts (Atom)
No comments:
Post a Comment