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();
}