Amdocs Interview Question

simple c programing code as i was fresher