#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
n = get_int("Height: ");
}
while(n <= 0 || n > 1);
// Print out first row
for(int i = 0; i < 1; i++)
for(int j = 0; j < 1; j++)
{
printf("# #\n");
}
do
{
n = get_int("Height: ");
}
while(n <= 1 || n > 2);
// Print out second row rows
for(int i = 0; i < 1; i++)
for(int j = 0; j < 1; j++)
{
printf(" # #\n## ##\n");
}
do
{
n = get_int("Height: ");
}
while(n <= 2 || n > 3);
// Print out third rows
for(int i = 0; i < 1; i++)
for(int j = 0; j < 1; j++)
{
printf(" # #\n ## ##\n### ###\n");
}
do
{
n = get_int("Height: ");
}
while(n <=3 || n > 4);
// Print out fourth rows
for(int i = 0; i < 1; i++)
for(int j = 0; j < 1; j++)
{
printf(" # #\n ## ##\n ### ###\n#### ####\n");
}
}
check50 prompts:
:) mario.c exists.
:) mario.c compiles.
:) rejects a height of -1
:( handles a height of 0 correctly
did not find EOF
:( handles a height of 1 correctly
timed out while waiting for program to exit
:( handles a height of 2 correctly
timed out while waiting for program to exit
:( handles a height of 23 correctly
timed out while waiting for program to exit
:( rejects a height of 24, and then accepts a height of 2
did not find " # #\n## ##\n"
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
See https://cs50.me/checks/ec2d8ccad685540ee866a2631ba20c6208d7bab4 for more detail.