C/C++ Solution to the problems posed in "P.M. Logicals" or "griddlers.net"