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.
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.
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 ...
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 ...
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.
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 ...
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 ...
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.
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, ...
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.