Answer:
The code you posted adds a whitespace after the number because you are using the printf(" ") statement inside the inner loop, which is printing a space after each number. To fix this, you can move the printf("\\") statement inside the inner loop, like this:
#include <stdio.h>
int main(void) {
int userNum = 3;
int i = 0;
int j = 0;
for (i=0; i<=userNum; ++i) {
for (j=0; j<=i; ++j) {
printf(" ");
}
printf("%d\\", i);
}
return 0;
}
This will print the numbers with the desired indentation and will not add any extra whitespace after each number.
Hope this helps!