# Thread: Problem with finding the middle character (ascii value)

1. ## Problem with finding the middle character (ascii value)

I can't find out which character has the middle ASCII value between the 3... I can solve the smallest and biggest but im having some issues with the middle one... pls help!

Code:
```#include <stdio.h>

int main(){

char a,b,c,big,small,mid;

printf ("Enter 3 letters:\n");
scanf ("%c %c %c", &a,&b,&c);
printf ("You entered: %c %c %c \n\n",a,b,c);

if (a<65 || (a>90 && a<97) || a>122){
printf ("Error");
return 0;
}

else if (b<65 || (b>90 && b<97) || b>122){
printf ("Error");
return 0;
}

else if (c<65 || (c>90 && c<97) || c>122){
printf ("Error");
return 0;
}

/* printout in alphabetic order */

big = (a>b?(a>c?a:c):b>c?b:c);
small = (a<b?(a<c?a:c):b<c?b:c);

/*mid = PLS_HELP_ME_OUT_HERE;*/

printf ("%c %c %c", small, mid, big);

return 0;
}```

2. Ummm... if you have 3 apples in a row... you know which one is on the left, you know which one is on the right... what do you know about remaining apple?

Think how to apply that to your program.

3. I know hot to get it with a "couple" of ifs but there must be a simpler way i just cant seem to notice...

4. Got it! Now I realize how stupid I was... Thanks XD i can't believe your tip actually helped :P

EDIT:

What if I want to alphabetize them and sort by capitals?

Example:

Input: b f B

Output: b B f