-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmario.c
More file actions
35 lines (31 loc) · 678 Bytes
/
mario.c
File metadata and controls
35 lines (31 loc) · 678 Bytes
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
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height, row, j, k, space, hash;
do
{
height = get_int("Height: ");
}
while (height < 1 || height > 8);
for (row = 0; row < height; row++) //rows
{
for (j = (height - 1); j > row; j--) //spaces
{
printf(" ");
}
for (k = 0; k <= row; k++) //# left
{
printf("#");
}
for (space = 0; space < 2 ; space++) //space in the middle
{
printf(" ");
}
for (hash = 0; hash <= row; hash++) //hashes right
{
printf("#");
}
printf("\n");
}
}