Please help me write a program to this problem? Inverted hollow pyramid

What have you tried?

Please don’t post images of text.

Don’t expect us to do your work for you. Make an attempt first. If you are not sure how to start, begin by writing down the steps you would use to do the task. For example, you might start by working out how many spaces are between the numbers:

  • row 1 is special, and only prints a single 1;
  • row 2 has 1 space between the numbers;
  • row 3 has 3 spaces between the numbers;
  • row 4 has 5 spaces between the numbers;
  • can you see the pattern?

Once you reach row N, you might just copy the previous rows you have already seen.

If the problem is too hard, start with a simpler problem like “print a triangle”:

1
2 2
3   3
4     4
5       5
6         6

and solve that. Once you have that code working, modify it to make a pyramid. Once that code is working, modify it again to invert it.

Good luck!