Pregunta de entrevista de IBM

Write a program in c/c++/java by giving a question