Question: C Programming: Create a function named printTriangleFor. The function should take an integer as a parameter for height and print a triangle of plusses and

C Programming:

Create a function named printTriangleFor. The function should take an integer as a parameter for height and print a triangle of plusses and dashes as shown below to the screen using only FOR loops. Do not use WHILE loops. If a value less than 1 is passed as an argument, the function should not print anything. The triangle should be printed with only spaces, dashes (minus), plus signs, and newlines. Each line should end with a newline. There should be spaces before the first plus sign and no spaces after the last plus sign. There should be no extra characters anywhere else. For example: printTriangle(7); should print a seven level triangle as shown below (note the height and width are both 7)

This function should be executed be another file like this:

C Programming: Create a function named printTriangleFor. The function should take an

Here is the main that runs it:

#include

//Sample main.cc

void printTriangleFor(int);

int main() {

printTriangleFor(7);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!