This program is to print a number pyramid.
Exercise: Write a program that prompts the user to enter an integer and then prints the pyramid wuth those many number of rows as shown below.
Enter the number of lines (between 1 and 15): 11 1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 6 5 4 3 2 1 2 3 4 5 6 7 6 5 4 3 2 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 10 11 10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 10 11
Download Code: Number Pyramid
No comments:
Post a Comment