Here is the prompt SystemoutprintHow many rows in the triang

Here is the prompt: System.out.print(\"How many rows in the triangle? \");

Print the integer.

Then using plus sign (+), display a filled isosceles triangle of the given number of rows. That means if the integer is 4, there will be four rows and the output will look like this - with the last row starting at the left edge:

Use nested loops

or

Solution

/*

* C Program to print full pyramid pattern using +

*/

#include<stdio.h>

#include<conio.h>

int main() {

    int row, space, rows, star=0;

    printf(\"Enter the number of rows in pyramid\ \");

    scanf(\"%d\",&rows);

    for(row = 1;row <= rows; row++) {

     /* Printing spaces */

        for(space = 1; space <= rows-row; space++) {

           printf(\" \");

        }

        /* Printing Plus */

        while(star != (2*row - 1)) {

            printf(\"+ \");

            star++;;

        }

        star=0;

        printf(\"\ \");

    }

    getch();

    return 0;

}

Here is the prompt: System.out.print(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site