0

First off let me say that I am a student and do not want any answers. What I do want is some help understanding why my logic isn't working so I can devise a new plan. Any help at all would be greatly appreciated because I am completely stuck atm and would like to get unstuck. Thanks, James.

```
/* Function definition--ascending */
void ascending() {
int x = 0;
int temp = 0;
float fUserArray[10] = {0};
for(x=0; x<10; x++) {
printf("\nPlease enter a number: ");
scanf("%f", &fUserArray[x]);
}//end for loop
for(x=0;x<10; x++) {
if(fUserArray[x] > fUserArray[x+1]) {
temp = fUserArray[x];
fUserArray[x] = fUserArray[x+1];
fUserArray[x+1] = temp;
}//end if
}//end for loop
printf("\nYour numbers in ascending order are:");
for(x=0;x<10;x++){
printf("\n%.2f", fUserArray[x]); }//end for
}//End ascending function
/**********************************/
/*Function definition--descending */
void descending() {
int x = 0;
int temp = 0;
float fUserArray[10] = {0};
for(x=0;x<10;x++) {
printf("\nPlease enter a number: ");
scanf("%f", &fUserArray[x]);
}//end for loop
for(x=0;x<10;x++) {
if(fUserArray[x] < fUserArray[x+1]){
temp = fUserArray[x];
fUserArray[x] = fUserArray[x+1];
fUserArray[x+1] = temp;
}//end if
}//End for loop
printf("\nYour numbers in descending order are:");
for(x=0;x<10;x++) {
printf("\n%.2f", fUserArray[x]);
}//end for loop
}//end descending function
/**********************************/
```

Like I already stated--> I can't figure out why the array isn't sorting and would like some help understanding where my logic is faulty thanks.

*Edited
by WaltP*: Added CODE Tags -- please use them