the out put for the program is provided below:

image