Print Pyramid?

How to print to screen the pyramid :

1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
0123456789876543210


Help me, thanks alot
what code you wrote??
This's my code, but may be wrong:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <conio.h>

main()
{
	int i, j, k, n=5;

      for (i=0; i<n; i++)
   {
   	for (j=n-1; j>i; j--)	printf(" ");
      for (j=0; j<2*i+1; j++)
      {
      	for (k=2*i; k>0; k--)	printf("%d", k);
         for (k=1; k<=2*i; k++)	printf("%d", k);
      }
      printf("\n");
   }

   getch();
}
closed account (S6k9GNh0)
When I get home, I have a small class and a couple algorithms that plug into the class that I can show. I might have to write the algorithms again though.

Should be something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

using namespace std;

int main()
{
      for (int i = numLines; i => 0; --i)
      {
            endl; //Skip down a line and...
            for (i = numLines; i > 0; --i)
            {
                  cout << " "; //...get smaller each time.
            }
            //Number algorithm here.
      }
}


EDIT: Never mind, I don't have it anymore. I could rewrite though...
Last edited on
Topic archived. No new replies allowed.