I am not very good at programming so thanks to all who help in advance. I can only utilize basic code that involves while, for, and do loops. in this case i think for loops are the most efficient.
I need to have a vector given 20 integers, smallest to largest, and then remove the items in the vector in the fewest possible steps by using the following process:
An element X in the data set can be removed along with X – 1 or X + 1 if they are present in the set. After each deletion, print the values remaining in the data set.
heres my code so far (only have the input) Any ideas?
#define numdata 20
int main ()
int data[numdata]; //array to hold data to sort
void getdata(int x)
int lcv; //loop control variable get data
for(lcv = 0; lcv < numdata; lcv++)
printf("Enter data #%d: ", lcv+1);
void riddata(int x)