0

I can't figure out how to make the pyramid work. My current code from the //create pyramid onward is:

//create pyramid

    for (int k = n; k+1<n; k++)

    printf("%d", k);

    printf("#");

    printf(" \n");

return (0);
}
0

OK, first of all, you can't expect help with such little information. For starters, your for loop sets k to n, whatever those values are, and then gives a condition, execute while k+1 is less than n, meaning it certainly wont execute, and even if it did, you are missing curly braces right after the for loop to enclose the code you want to loop meaning it would execute only the line of code immediately after the loop. Lastly for now, you seem to be printing a number, k yet the pyramid if I recall was made up of hashes:(

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .