Happy About the progress
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
#include <cs50.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void draw(int n);
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
int height = get_int("Height; ");
|
||||
|
||||
draw(height);
|
||||
}
|
||||
|
||||
void draw(int n)
|
||||
{
|
||||
// Base case, making sure loop has exit condition.
|
||||
if (n <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Print a pyramid of height n -1
|
||||
draw (n-1);
|
||||
|
||||
// Print one more row
|
||||
for (int i =0; i < n; i++)
|
||||
{
|
||||
printf("#");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
Reference in New Issue
Block a user