0

Errors

:) mario.c exists

:) mario.c compiles

:) rejects a height of -1

:( handles a height of 0 correctly \ expected an exit code of 0, not output of "Input a postive between 1 and 23\n"

:( handles a height of 1 correctly \ expected output, but not "Input a postive between 1 and 23\n"

:( handles a height of 2 correctly \ expected output, but not "Thanks for the number betwen 1 and 23 ..."

:( handles a height of 23 correctly \ expected output, but not "Input a postive between 1 and 23\n"

:( rejects a height of 24, and then accepts a height of 2 \ expected output, but not "Thanks for the number betwen 1 and 23 ..."

:) rejects a non-numeric height of "foo"

:) rejects a non-numeric height of ""

// make mario jump over a pyramid

int i;
int j;
int k;
int n;

do                                          
{
printf ("Input a postive between 1 and 23\n");   

n = GetInt () ;

}
while ((  n <= 1 )  || (n >=   23));  //  input while false print poative and number 1  to 23  

printf  ("Thanks for the  number betwen 1 and 23 \n");                                                                 // mistake (())forgot this did () instead 

     //begininning for loop print prymadid of hash that mario can climb





 for (i = 1;  i<= 4; i++)              
 { 
     for (k=i; k<=4; k++ )              //         
     {
     printf(" ") ;
     } 

      for ( j  = 0 ; j <= i; j++)              
      {
      printf ("#");
      }   

 printf("\n"); 

 }   

}

1 Answer 1

0
while ((  n <= 1 )  || (n >=   23)); 

This code is rejecting valid values. 0, 1, and 23 are all valid input.

Also, you've added a thank you message for entering correct data. Unfortunately, there's nothing in the spec for this. The hidden lesson in the early psets is to write the code to exactly what is in the specification. No extras, nothing missing. That means that any missing or extra comments, prompts, punctuation, whitespace, etc. will cause a fail.

In a team programming environment, this is especially important. Each programmer is given a piece of the program to write. They need to write exactly to spec so that when the pieces are put together, they will actually work together as a whole.

This is why these tests are failing. There are other issues, but that's for a new question, once you have had a chance to work on them. ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .