Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program using nested loops to display the pine tree as show below. For t

ID: 3656497 • Letter: W

Question

Write a program using nested loops to display the pine tree as show below. For the top of the tree, you should have two inner loops, the first to print the spaces in front of the *'s and the second 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 are shown below. 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 as end line two times.

Explanation / Answer

please rate - thanks

#include <conio.h>
#include <stdio.h>
int main()
{int i,j;
for(i=0;i<7;i++)
    {for(j=0;j<7-i-1;j++)
         printf(" ");
    for(j=0;j<i*2+1;j++)
         printf("*");
    printf(" ");
}
for(i=0;i<3;i++)
    { printf("     *** ");
    }
getch();
}   
      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote