Write a program that prints an inverted triangle. Use the *
symbol to draw the triangle. The desired output should look like this:
e.remove());
document.dispatchEvent(
new CustomEvent('setAceCode', { detail: code.innerText })
);
const lessonContentWrapper = document.getElementById('lessonContentWrapper');
if (lessonContentWrapper) {
lessonContentWrapper._x_dataStack[0].layout = 'editor';
}
$el.innerText = 'Moved!';
setTimeout(function () {
$el.innerText = 'Move to Editor';
}, 3000);
">Move to Editor
e.remove());
navigator.clipboard.writeText(code.innerText);
$el.innerText = 'Copied!';
setTimeout(function () {
$el.innerText = 'Copy';
}, 3000);
">Copy
1*******
2 *****
3 ***
4 *
Type the program code on the next page and then run it. If the output of your code is correct, submit it to earn points for this exercise.
Solution Video
First, try to solve the question yourself. If you can't, watch the solution video: