im having a hard time trying to understand how to print the hashes in increasing order. So far i know how to do the spaces(decreasing order) This is my code right now:
/*
* Ask the user for a height greater than 0 lower than 23
* Prints a mario castle tower.
*/
#include <stdio.h>
#include <cs50.h>
int main (void)
{
int size;
string hash = "#"; // hashes to print in increasing order
string space = "*"; // for testing purposes
do
{
size = get_int("Height: "); // gets the info from the user
}while(size < 0 || size > 23);
int count = 0;
printf("Height is: %i\n", size);
while(size > count)
{
for(int i = 0; i <= size; i++)
{
for(int j = size -1 ; j > 0; j--)
{
printf("%s", space);
}
for(int k = 0 ;k > count ; k++)
{
printf("%s", hash+1);
}
} printf("\n");
// printf("\n");
count++;
size--;
}
}
What is the logic behind printing the hashes? SOS!
Regards.