GGK interview question

Programs based on mainly logic