// Use a nested for loopto draw the upside down triangle with base size. // the
ID: 3617851 • Letter: #
Question
// Use a nested for loopto draw the upside down triangle with base size.
// the outer loop will control each line and the number ofleading spaces
for (________________________________________________)
{
// draw leadingspaces
for (____________________________)
cout << " ";
// draw a line withsymbol
for (____________________________)
cout << symbol;
cout <<endl;
}
Explanation / Answer
please rate - thanks //PURPOSE: This program draws an up-side-down isoscelestriangle. The base of the triangle and the character to fillwill be // provided as input. The base should be an odd number and theheight of the triangle will be depend on the base. // For example, the isosceles triangle with base 5 is // ***** // *** // * #include #include using namespace std; int main () { //local variables int base; // the size of thebase char symbol; // the characterto fill int space; // the counter forspacing // Read the character to fill cout > symbol; // Read the size of the base of the triangle,the size should be odd. do { cout base; } while (base/2*2 == base); // Use a nested for loop to draw the upside down triangle with basesize. // the outer loop will control each line and the number ofleading spaces for (int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.