Search

# cs50 pset1: Mario (less/more)

Finishing this first problem set really caught me off guard– it was a lot harder than the Scratch task (in pset1). However, after working on it for a couple of hours (probably 10-12 in total), I completed it and I can't say I'm not proud.

The programming language is C by the way. I genuinely think I found it a little difficult to start off because I already had some knowledge of Python, and having to put that aside and focus on only writing C was a little difficult (if you get what I mean).

Here is the bit of code I found the trickiest for the less comfortable task:

```    while (n < 1 || n > 8);

for (int i = 1; i <= n; i++)
{
//print spaces
for (int j = 1; j <= n - i; j++)
{
printf("");
}
//print #
for (int j = 1; j <= i; j++)
{
printf("#");
}```

My comments (//) in the code pretty much explain what each part means. Having to create two loops was something I figured out soon but the part where we had to compare the loops

for (int j = 1; j <= i; j++)

was pretty tricky.

I found this task a little difficult at the start but if you go step-by-step along with CS50's instructions, it's pretty do-able. Let me know if you can follow through or if your code (if you're doing the course) was any different!

Here is my the part I found tricky for the more comfortable task:

```    for (int i = 1; i <= n; i++)
{
//column (j)
//print spaces
for (int j = n - i; j > 0; j--)
{
printf("");
}
//print hashes
for (int j = 1; j <= i; j++)
{
printf("#");
}```

The more comfortable task took me a lot longer and I honestly found it quite difficult. I guess you could say that this (sort of) worried me as it was only pset1 but I pushed through and I am really enjoying the course.

If you're interested in starting the course too then it's called CS50's Introduction to Computer Science. You can also check out this post to learn more on it: starting-cs50-s-introduction-to-computer-science

38 views

See All