Subscribe Us

Responsive Advertisement

Advertisement

problem 6(delete an element in given location)

 



//problem 6(delete an element in given location)

#include<stdio.h>

int main()

{

    int n,loc;

    int size=5;

    int arr[7]={10,20,15,4,5};

    printf("Enter your location : ");

    scanf("%d",&loc);

    for(int i=loc;i<size-1;i++)

    {

        arr[i]=arr[i+1];

    }


   size--;

   for(int i=0;i<size;i++)

   {

       printf("%d ",arr[i]);

   }

   printf("\n");

    return 0;

}


Post a Comment

0 Comments