0
#include <stdio.h>
#include <cs50.h>

int main(void) 
{

    int pyramid_height = 0;


    do {
        printf("Height:");
        pyramid_height = GetInt();
        if (pyramid_height == 1)
        {
            return 0;
        }
    } while (pyramid_height < 1 || pyramid_height > 8);

    /*

    */ 
    for(int i = 0; i < pyramid_height; i++) 
    {

        for(int j = 0; j < pyramid_height-i-1; j++)
        {

            printf("%s", " ");
        }

        for(int k = 0; k < i+1; k++)
        {
            printf("#");
        }
        printf("\n");
    }   
    return 0;
}

// :( handles a height of 1 correctly expected "#\n", not ""

THIS IS ERROR

0
if (pyramid_height == 1)
{
    return 0;
}

I not at all understand these statements. What is your intention ?, but you can not expect your program print a single hashtag Piramide.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .