Program to find smallest 5 values in a matrix using C

I'm trying to find the smallest 5 values in a 6*6 matrix using C. Note I was successful in finding the least value as well as finding the least values from a 1D array, but could not make it to iterate and get the least 5 values of the matrix using 2D. Any ideas appreciated.

[The sample of a matrix I want to sort and get the lowest values]

2.36^2 5.01^2 1.00^3
1.25^3 1.09^2 2.98^2
1.09^2 2.50^3 1.81^5