Welcome fellow students, register yourself and dive into asking questions, giving answers and helping the community learn with you.

Pset1 obstacle with finishing the pyramid

0 votes
asked Jun 4, 2018 in Pset1 by jcpadg07 (120 points)
I have been able to create a pyramid but it is facing the wrong direction.  I am having trouble being able to add the spaces before the sharps.  Here is the code I have written so far:

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

int main(void)
{
    //Prompt user for a positive number
    int n;
    do
    {
        n = get_int("Height: ");
    }
    while (n <= 0);
    //Print out this many rows
    for (int i = 0; i < n; i++)
{
    //Print out this many columns
    for (int j = 0; j < i; j++)
{
    printf("#");
}
    printf("\n");
}
}

Please log in or register to answer this question.

Welcome to CS50xHelpers Q&A, where you can ask questions and receive answers from other members of the community.

186 questions

248 answers

217 comments

2,854 users

2 Online
0 Member And 2 Guest
...