Adding the example given. It can be compiled and executed.