My brain is completely stumped. I wrote this out on paper, and I discovered that as the hash tags increase, the spaces decrease going top to bottom. My problem is that the pyramid is left aligned, instead of right. I can't figure it out..
#include <stdio.h>
#include <cs50.h>
#include <math.h>
//asks and gets input from user.
int main(void){
printf("What is the height of the pyramids, you desire?");
int height=GetInt();
//fail-safe should the user give a range out of bounds
while(height<=0 || height>23){
printf("Invalid number, pleaser enter a valid number. What is the height?");
main();
}
//constructs the pyramid, based upon the height given by the user.
for(int i=0; i<height; i++)
{
printf("\n");
for (int k=0;k<=i;k++)
{
printf(" ");
}
for(int j=0; j<=i;j++){
printf("#");
}
}
}