We know that,
9 > 8 > 7 > 6 > 5 > 4 > 3 > 2 > 1
We need to keep 8 in hundred's place
The greatest five-digit number = 97865
The smallest five-digit number = 10823
Hence, 97865 is the greatest and 10823 is the smallest five-digit numbers with 8 in hundred's place and with all the digits different.