0

I finally reached the key for making this project but my problem is with the side of the pyramid i want it to be left sided instead.

#include <cs50.h>
  #include <stdio.h>

int main(void)
{
printf("Height:");
int h ;
h=0 ;
do
{
     h = get_int();
}
while ( h< 0 || h > 23);
  int i;
  i=1;
   for (i=1;i<=h;i++)
   {

           int y;
           y=0;
         for(y=0;y<=i;y++)
     {
         printf("#");
     }
      int s;
      s=1; 
     for(s=1;s<h-i;s++)
       {
           printf(" ");

        }
        printf("\n");
   }

}

Any suggestions?? Please give me some clear hints.

0

If you want to print spaces before hashes, then swap those inner loops, first do the loop with the spaces, then do the one with the hashes.

You must log in to answer this question.

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