Accenture interview question

Basic logic question (not programming related) followed by two explicit coding questions.