Given an array of integers and we have to delete a given element.
For example we have list of integer: 10 20 30 40 50
Here we want to delete 30 from array. We compare each element with given element; if we found element in array then we store position in a variable. And then perform shift operations to delete element from the list.
If we did not find given element into array then there is no need to perform shift operation. Because there is no need to delete any element from array.
Consider the example:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer