How much time did you spend on it?
/**
* CS50: Mario
* Aleksey M.
* 27.04.17
*
*/
// Compile: clang -o mario mario.c -lcs50
// Run: ./mario
#include <stdio.h>
#include <cs50.h>
int height;
int hashes;
int spaces;
int main(void)
{
// Ask the user about input from 1 to 23
do
{
printf("Height: ");
height = GetInt();
} while (height < 0 || height > 23);
for (int row = 0; row < height; row++)
{
// Print spaces
for (spaces = height - (row + 1); spaces > 0; spaces--)
{
printf(" ");
}
// Print hashes
for (hashes = 0; hashes <= row + 1; hashes++)
{
printf("#");
}
printf("\n");
}
return 0;
}
/**
* CS50: Mario
* Aleksey M.
* 27.04.17
*
*/
// Compile: clang -o mario mario.c -lcs50
// Run: ./mario
#include <stdio.h>
#include <cs50.h>
int height;
int hashes;
int spaces;
int main(void)
{
// Ask the user about input from 1 to 23
do
{
printf("Height: ");
height = GetInt();
} while (height < 0 || height > 23);
for (int row = 0; row < height; row++)
{
// Print spaces
for (spaces = height - (row + 1); spaces > 0; spaces--)
{
printf(" ");
}
// Print hashes
for (hashes = 0; hashes <= row + 1; hashes++)
{
printf("#");
}
printf("\n");
}
return 0;
}