Completed C Solution for PROT