My code seems to be working but I keep failing on check50. As an example, I get this back from check 50:

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

I'm not sure what is going wrong, any ideas? My code is as follows:

//get user input int n;

do {
printf("Give me a positive integer no greater than 23.\n");

n = GetInt();

}while(n > 23 || n < 0);

//build pyramid for (int i=0; i < n; i++) {

   for (int a=i+1; a < n; a++)
   {printf(" ");}

   for (int b=n-i; b > 0 && b <= n; b++)






This is an example of making sure to follow the exact specifications. In a pyramid of height 1 (or any height), how many hashes are supposed to be printed on the first line?

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

| improve this answer | |

You must log in to answer this question.

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