Created
September 13, 2020 04:16
-
-
Save deeunix/87d6e569b4760d0559465f985c7d3481 to your computer and use it in GitHub Desktop.
cs50 Mario solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
int height; //declare int variable Height | |
do | |
{ | |
height = get_int("Height: "); | |
} | |
while (height < 1 || height > 8); //make sure height is not less than 1 or greater than 8 | |
for (int row = 0; row < height; row++) //to print new line as ROW | |
{ | |
for (int space = height - row - 1; space > 0; space--) //to print SPACE | |
{ | |
printf(" "); | |
} | |
for (int hash = 0; hash < row + 1; hash++) //to print hashes(#) | |
{ | |
printf("#"); | |
} | |
printf("\n"); | |
} | |
} | |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment