-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmario(C)
39 lines (31 loc) · 1015 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
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height; //Declaing var
do { // Beginning of do/while loop
height = get_int("Height: ");
}
while (height < 1 || height > 8); // End of do/while loop
if (height > 0 || height < 9) { // Beginning of if(1) formula
int counter = 0;
for (int row=0; row<height; row++) {
if (counter != height) { // Beginning of if(2) formula
for (int spaces = (height-1) - counter; spaces > 0; spaces--) {
printf(" ");
}
for (int hashes = 0; hashes <= counter; hashes++) {
printf("#");
} // End of if/for
//ignore this block below if you want only one side
printf(" ");
for (int hashes = 0; hashes <= counter; hashes++) {
printf("#");
}
//##################################################
printf("\n");
counter++;
}
}
}
}