IBM interview question

Solve a programming question/Write a program