Your question is a bit confusing to me. What do you mean by 'element'? Do you want to save something from user input? We can't help you unless you are more specific.
yeah, i want to find min and secondarymin element in an array, for this should first find min element and save it and then delete. in step 2 find secondaryMin element
Sorry...I'm still confused. You have an array of values (ints/doubles?) and you want to find the two smallest values in the array? What's the point of saving the smallest element (min) and then deleting it? Please elaborate...
at first find ( a[1]=2 )
next find a[5]=3 that is Secondarymin element in this array. if you dont delete a[1]=2, in this step the compiler refind a[1]=2 as minimum element.
Let's write what you want to do in words. I'm assuming that the array isn't sorted. We'll use a basic sequential search.
1. Set 'min' to be equal to the first (i.e. index zero) element. Have another variable called 'secondMin' handy.
2. Loop through the remaining elements in the array. If an element is less than min, set secondMin = min, and min = newElement.
At the end of the loop, secondMin will be your second smallest element, and min will be your smallest.
Try and translate the above into code. Post your attempt if you get stuck.