In this program, we use numbers to generate a pyramid-like pattern. And numbers follow a pattern similar to this: 1…