code of problem C