Skip to content

Instantly share code, notes, and snippets.

@i0na-k
Created February 3, 2016 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i0na-k/c9a915537a71368b0e72 to your computer and use it in GitHub Desktop.
Save i0na-k/c9a915537a71368b0e72 to your computer and use it in GitHub Desktop.
#include <cs50.h>
#include <stdio.h>
int main (void)
{
int height = 0;
// getting an input from the user
do
{
printf("give Mario a number:");
height =GetInt();
}
while(height < 0 || height > 23);
for (int i = 0; i < height; i++) // run height times
{
//should iterate height times
//print the space
for (int s = 7; s >= i+1; s--)
//iterate space times
{
printf (" ");
}
//printing the blocks
for (int k=0; k <= i+1; k++) //iterate
{
printf ("#");
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment