0

When checking with , I get these errors

:( handles a height of 1 correctly 
   \ expected output, but not " ##\n" 
:( handles a height of 2 correctly 
   \ expected output, but not " ##\n ###\n" 
:( handles a height of 23 correctly 
   \ expected output, but not "Height: " 
:( rejects a height of 24 
   \ expected output, but not "Height: "

here's my code:

 do
 {
     printf("Height: ");
     n = GetInt();
     z = n;
 }          
 while(n < 0 ||  n >= 23);   

 for(i = 1;i <= n;i++)        
 {
     {                    
         for(j = z; j > 0 ; j--)                        
             printf(" ");

         z--;
 }                                                              
1
  • i am getting these errors :( handles a height of 1 correctly \ expected output, but not " ##\n" :( handles a height of 2 correctly \ expected output, but not " ##\n ###\n" :( handles a height of 23 correctly \ expected output, but not "Height: " :( rejects a height of 24 \ expected output, but not "Height: " – prasku Jun 22 '15 at 10:31
1

check50 expects exact output. If it's not perfect, it's wrong. Your code is printing one extra leading space on every line. For example, if height = 1, your code outputs _## while check50 expects ## (space replaced with underscore for clarity).

Also, you have a second error. Your code will not print a pyramid of height = 23.

If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)

You must log in to answer this question.

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