I'm almost there in solving the pset1 of cs50 mario.c the problem in my code is when i enter a number more than 1 and less than 23 , it goes in infinite loop and prints spaces all the way without stop. I'm quite sure the problem in the condition of my "spaces for loop" but i don't know where exactly the problem is if anyone can provide me tips to overcome this problem , it will be great ! thanks !
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int m ;
int row , hash , space ;
// we will need to prompt the user at least once so , do-while loop
do
{
printf("Height: ");
m = GetInt() ;
}
while ((m < 0) || (m > 23)) ;
//Drawing the pyramid
for (row = 0 ; row < m ; row ++)
{
for (space = 0 ; space < (m-1) ; space--)
{
printf(" ");
}
for (hash = 0 ; hash < ((m+1)-(m-1)) ; hash++)
{
printf("#");
}
printf("\n");
}
}