Nested Loop Assignment Write a program using nested loops to display the pine tr
ID: 3533206 • Letter: N
Question
Nested Loop Assignment
Write a program using nested loops to display the pine tree as show below.
*
***
*****
*******
*********
***********
*************
***
***
Hint: For the top of the tree, you should have one loop that counts the rows 1-7. Then, you should have two inner loops, the first to print the spaces in front of the *'s and the second to print the *'s on that row. The number of spaces and the number of *'s for each row are shown below.
Row Spaces *'s
1 6 1
2 5 3
3 4 5
4 3 7
5 2 9
6 1 11
7 0 13
You will then have another loop after the nested loop to print the tree trunk. That one should print 5 spaces, then 3 asterisks, and then an end line two times.
I've been falling behind in this class and the tutors simply aren't attending their sessions with me, any help would be great.
I'm using Notepad ++ and Cygwin Terminal
Explanation / Answer
http://ideone.com/cWAdhK
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.