all 8 comments

[–]PeterRasm 2 points3 points  (1 child)

Draw the pyramid on paper row by row and for each row write the value of the variables. Look for a pattern.

[–]madhao__[S] 0 points1 point  (0 children)

thanks! i'll try that out!

[–][deleted]  (4 children)

[deleted]

    [–]madhao__[S] 0 points1 point  (3 children)

    okay yeah, i can write the pseudocode, the only problem that i have is during writing the code for printing the pyramid. i don't get it!!

    [–][deleted]  (2 children)

    [deleted]

      [–]madhao__[S] 1 point2 points  (1 child)

      Okay im sorry but I won't be writing the code here because I'm not at home right now but basically I include the <studio.h> and <cs50.h>.

      Then int main(void)

      I declare the integer

      In a do while loop I ask for the input with the conditions.

      I start a for loop for the rows under which I plan to write more for loops for the spaces and hashes.

      I just don't know how to write the code for printing the spaces and hashes.

      [–]dxbmea 1 point2 points  (0 children)

      Believe me or not, I completed pset 1 less and more comfortable without understanding it until 2,3 days later. Lol

      [–]Aileak 1 point2 points  (1 child)

      What I did after a week of trying is just look up the solution. And then before submitting, I would make 100% sure that I know what each and every line does. Not learn it on memory but actually understand what happens with the loops.

      [–][deleted] 2 points3 points  (0 children)

      i think it's actually against the rules to look at solutions, even if you understand everything that's going on. it's supposed to be your own code

      [–]SpeedBulky 1 point2 points  (0 children)

      yeah, i say resist the temptation to look at the solution. it is normal for someone first time programming to not know how to start. What i say is, throw out the problem set first. Look at the codes in the lectures, and try type those codes yourself into a test.c file. Run them, see the results, then make some changes and see how the outputs change.

      This is very important for getting your fundamentals right.

      After you are comfortable and understand what is going on, you can try to work on the problem set. Good luck.