Yamaha interview question

For Star pattern as described on the paper, provide the code to print this in cpp.