added the same program but in C