Added solution of problem1 in C