HTML & JS
#include<iostream>
using namespace std;
int main()
{
   int a[10]={23, 45, 67,1};
   int n=4;  //element count
   //deleting element- 45
   cout<<"The elements before deletion :";
   for(int i=0;i<=n-1;i++)
      cout<<a[i]<<" ";
   int s=1;    //index value of deleting element(45)
   for(int s=1;s<=n-1;s++)
      a[s]=a[s+1];
   n--;
   cout<<"\nThe elements after deletion:";
   for(int i=0;i<=n-1;i++)
      cout<<a[i]<<" ";
}

Generated URL:

Output:

The elements before deletion :23 45 67 1 
The elements after deletion:23 67 1 
Report Bug