Tech Mahindra Interview Question

Was asked to write Program of Pattern and do its dry run