Cognine interview question

Questions on pattern printing and few math questions