I want to find third maximum of five numbers and it's position.
My code find Maximum correctly but it's position is wrong!
What's the problem?
Thanks!
Code:
#include <stdio.h>
#include <conio.h>
int main ()
{
    int x_max1;
    int x_max2;
    int x_max3;
    int order_m_3;
    int x [5];
    for (int i = 0; i < 5; i++)
        {
        printf ("Enter A Number:\n");
        scanf ("%d", &x [i]);
        }
    x_max1 = x [0];
    for (int i = 1; i < 5; i++)
    {
        if (x [i] > x_max1)
           x_max1 = x [i];
    }  
    x_max2 = -10000;
    for (int i = 1; i < 5; i++)
    {
        if (x [i] > x_max2 && x [i] != x_max1)
        x_max2 = x [i];
    }
    x_max3 = -10000;
    for (int i = 1; i < 5; i++)
    {
        if (x [i] > x_max3 && x [i] != x_max1 && x [i] != x_max2)
        x_max3 = x [i];
        order_m_3 = i + 1;
    }                 
    printf ("Third Max is %d and Position is %d", x_max3, order_m_3);
    getch ();
    return 0;
}