Promatics interview question

Basic java program like pattern