-
Notifications
You must be signed in to change notification settings - Fork 0
/
mario.c
44 lines (36 loc) · 970 Bytes
/
mario.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int height = 0;
// TODO: Take the user's height if it is between the numbers 1 and 8
do
{
height = get_int("Height: ");
}
while (height <= 0 || height >= 9);
// TODO: Build pyramid
for (int hashes = 1; hashes <= height; hashes++)
{
// TODO: Get height for pyramid and the line number
// TODO: Find out how many points you need on that line
int dots = height;
while (dots > hashes)
{
dots--;
printf(" ");
}
for (int hasheLeft = 0; hasheLeft < hashes; hasheLeft++)
{
printf("#");
}
printf(" ");
printf(" ");
// TODO: add 2 spaces next to the left pyramid and then add a pyramid to the right
for (int hasheRight = 0; hasheRight < hashes; hasheRight++)
{
printf("#");
}
printf("\n");
}
}