adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to delete an number from an array

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 

  1. Program in C to delete an number from an array

Post a Comment

0 Comments