Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please help me to write a program to implement this algorithm..

write an algorithm to accept number between 1 and 9 and display the pattern.
For example, if the number entered is 5, the following pattern should be displayed:

a. Triangle pattern

1

2 1

3 2 1

4 3 2 1

5 4 3 2 1


b. Pyramid pattern

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


Thanks for your answer.. :)
Posted
Updated 29-Nov-17 14:37pm

Please don't ask for solutions to your homework/assignments, you should do the by yourself if you want to learn.
 
Share this answer
 
This is a very basic algorithm you may code it easily in (almost) every programming language available.
If you can't deal with it, please, read a good programming tutorial (or better, programming book).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900