3

If I remember correctly, there should be two spaces between the half-pyramids. If the output is not put into an HTML pre tag, any contiguous whitespace will be compacted into one space, that's why you probably don't see anything in the check50 output.


2

See anything wrong here? for (rows = 0; height <= rows; rows++) If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


2

If you do the math it should equal 20, which would validate as the last number in the integer is 0. Make sure when a digit is doubled for the first calculation of Luhn's algorithm, you are taking sum of digits if it's double digits rather than the product itself. i.e (7*2 = 14) you would add 1 + 4, which would give you 5 rather than just using 14.


1

The problem that you're seeing is here: quantity = round (quantity * 100); So, what is the value of quantity before this line execute? What variable actually contains the value of the change to be counted? There's another issue in the code, but it's an easy fix. I'll let you find that after you fix this. ;-) If this answers your question, please click ...


1

Why are you using modulo for this? It produces an unreliable result in this usage. Further, the actual numbers don't make sense. The modulo function returns the remainder after an integer division. So, for example, say that you're doing while (cents % 10 == 5) If cents were $1.05, it would be true, but if cents were $1.06, it would be false. In both ...


1

From your screenshot, you are typing the code into the terminal itself. That does not work. You should be writing all of your code inside hello.c in the editor. Then, once you have done that, you run make hello to compile it, and then ./hello to run your code.


1

There are serious issues with the way that you're trying to use IF statements. First of all, "n=x" is always true. A single "=" sign is an assignment operator. In other words, it always assigns the value on the right to the variable on the left, and will always evaluate as true. If, instead, you want to check if two things are equal, you need to use the ...


1

Think about what the for loops and i and j are doing. The outer loop is counting the rows from 0 to n-1, which is ok. But look at the inner loop: for (j= i; j < n; j++) Now, say that n = 5. On the first outer loop, i=0. That means that j starts at 0 and counts to 4, so it'll print 5 hashes. Next pass, 1 to 4 and so on. That's why the pyramid is upside ...


1

Just check50 cs50/2018/x/hello, without mentioning hello.c (as it used to be years ago). The checker will get a list of files to upload. https://docs.cs50.net/2018/x/psets/1/hello/hello.html#code-check50-code


1

The problem is simple. There are supposed to be TWO spaces between the left and right sides of the pyramid. It's only partly your fault that you couldn't figure it out. The output from check50 seems to indicate that there's only supposed to be one space, while the pset spec says two. I'll pass a request on to fix this. If this answers your question, ...


1

Looks like check50 got a different file. Maybe you have forgotten to save, or you are in the wrong directory, one where you stored a solution to mario.less? check50 will always upload mario.c from current directory, it may not be renamed.


Only top voted, non community-wiki answers of a minimum length are eligible