#Pyramid With A Constant Special Char in the middle

4 messages · Page 1 of 1 (latest)

coral violet
#

In every row the nth element is +

coral violet
#
#include<stdio.h>
int main()
{
    int n=5;
    for (int i=1; i<=n; i++) //row
    {
        for(int j=1; j<=2*n; j++)
        {
            if(j<(n-i+1))
                printf(" ");
            else if(j==n)
                printf("+");
            else if(j<n)
                printf("*");
            else if(j>n&&j<=n+i-1)
                printf("*");
        }
        printf("\n");
    }
    return 0;
}
jovial gorgeBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.

restive knoll
#

!solved