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

//Requires: n > 0 //Modifies: nothing //Effects: prints an equilaterial triangle

ID: 3631409 • Letter: #

Question

//Requires: n > 0
//Modifies: nothing
//Effects: prints an equilaterial triangle
// starting with one *
// continuing until the last row has 'n' *'s
// this last row will start with a * and have one space between *'s
// with a parameter of 3 gives
// must be left justified and must NOT have any characters past the last *
// in any given line
// put one and only one blank line after the last line of the triangle
// do not begin with a blank line
// printEquilateral(3);
// printEquilateral(4);
// will print
// *
// * *
//* * *
//
// *
// * *
// * * *
//* * * *
//
void printEquilateral(int n);

Explanation / Answer

please rate - thanks

#include <iostream>
using namespace std;
void printEquilateral(int );
int main()
{printEquilateral(3);

printEquilateral(4);
system("pause");
return 0;
}
void printEquilateral(int n)
{int i,j;
for(i=0;i<n;i++)
   {for(j=0;j<=i;j++)
       cout<<"*";
   cout<<endl;
   }
cout<<endl;  
}