30 lines
540 B
C
30 lines
540 B
C
#include <cs50.h>
|
|
#include <stdio.h>
|
|
|
|
void print_row(int bricks);
|
|
|
|
int main(void)
|
|
{
|
|
// Prompt user for heing (int)
|
|
int height = get_int("Height: ");
|
|
|
|
// Print Payramid of that height
|
|
for (int i = 0; i <= height; i++)
|
|
{
|
|
print_row(i + 1);
|
|
|
|
//Print row based on height
|
|
printf("#");
|
|
printf("\n");
|
|
}
|
|
|
|
}
|
|
// Given a how many a # to print out, print that number of bricks
|
|
void print_row(int bricks)
|
|
{
|
|
for (int i = 0; i< bricks; i++)
|
|
{
|
|
printf("#");
|
|
}
|
|
printf("\n");
|
|
} |