Maveric Systems interview question

Own program to write numbers in given sequence