Hello every one!

i want to create something like this (show at the bottom of this message as an attachment) but i've no clue how to create this digital payrmid.

can anyone please help me with the code please?

thanks for your help in advance

cheers
sh4rif

1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1

Recommended Answers

All 4 Replies

Watch out!

The obvious patterns here are looking to bite you! ;)

You need to put some effort into this. We don't serve as homework bwitch's. We help people who are willing to show some real effort.

do something................

i think you got how to display the upper pyramid
Then its easy to create the lower one
try...

Hope that helps you!

# include <stdio.h>

int main()
{
    int i,j;
    
    for (i=1; i<10; i++) {
	for (j=1; j<i; j++) 
	    printf("%d",j);
	
	for (j=i; j>=1; j--)
	    printf("%d",j);
	
	printf("\n");
    }
    
    for (i=9; i>=1; i--) {
	for (j=1; j<i; j++) 
	    printf("%d",j);
	
	for (j=i; j>=1; j--)
	    printf("%d",j);

	printf("\n");
    }
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.