Happy About the progress
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#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");
|
||||
}
|
||||
Reference in New Issue
Block a user