Hacker Challenge: Christmas Tree
Test your problem-solving skills in the Christmas Tree challenge.
We'll cover the following
Challenge
Your code should print the following shape:
h
is the height of a single complete pyramid.
Implementation Directions
If you observe the top green part closely, which contains three green triangles, they have the same triangle being printed in different regions. Therefore, you should make a generic code that prints the triangles with a range and height passed as arguments. In the main part, you should call the function that prints the triangle three times with separate ranges. After printing the green part, the trunk is a rectangle with the mentioned dimension and then followed by a floor.
#include <iostream>using namespace std;void christmasTree(int h){cout<<"Height:"<<h<<endl;// write your coder here}