-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmario2.c
42 lines (34 loc) · 807 Bytes
/
mario2.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
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height;
do {
height = get_int("Height: ");
}
while (height > 8 || height < 1);
for (int i = 1; i <= height; i++){
for (int j = height; j >= i; j--){
if ( j > i){
printf(" ");
}
else {
for(int k = 1; k<=j; k++){
printf("#");
}
}
}
printf(" ");
for (int j = 0; j <= height; j++){
if ( j < i){
printf("#");
}
else {
for(int k = 1; k<=j; k++){
printf(" ");
}
}
}
printf("\n");
}
}