whats wrong with this code it compiles well but gives wrong results

code is to arrange the 5 numbers in ascending order

```
for (a=0;a<=4;a++)
{
for (b=a+1;b<=4;b++)
{
if (num[a]>num[b])
{
temp=num[a];
num[a]=num[b];
num[b]=temp;
}
}
}
```

can anyone tell whats wrong??