@C-Noob: I think I can use GetInt() because I have a pre-programmed library in my linux system.
@Tclausex: Thank you for answering! You're absolutely right in that my second inner loop cannot include row. However, I don't understand what is wrong with my boolean test expression in my for() loop; the expression in my first inner loop will evaluate to true because row will eventually reach x -1 (since row increases by 1 every time).
I'm trying to break down the nested loop into simplified steps and I have:
Code:
#include <cs50.h>
#include <stdio.h>
int main(void)
{
printf("Insert an integer less than 24: ");
int x = GetInt();
// to get the spaces right, where D is equivalent to a space
int c;
for (c = (x-1); c == 0; c--)
printf("D")
printf("\n");
return 0;
}
I don't understand why when I run the simplified code, D does not print.