Skip to content

anonymous /gist:5147109

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#include <cs50.h>
#include <stdio.h>
int main();
int height;
// user input first
{
do
{
printf("How tall do you want the pyramid?");
int height = GetInt();
}
while ( height <= 0 || height > 23 );
int i = 0;
for(i = 0; i <= height; i++)
{
//declare hash initialization
int hash = i - 1;
while (hash >= 0 && hash <= height) // declare hash condition
{
printf("#");
hash++;
} //declare hash update
//declare space initialization
int space = i - 1;
while (space >= 0 && space <= height) // declare space condition
{
printf(" ");
space--; // declare space update
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.