By knowing that int m and int k are placeholders (formal parameters) for entered values of x and y, how come, if for example x < y, the program still calculates the correct result ? I wrote int s = m % k so that should mean that s = x % y ? How program knows which number is greater and which one is smaller ? Bottom line, if I enter 24 and 6, I get 6 as result (which is OK), but when I enter 6 and 24 I get same result, which is also OK, just I dont understand how ??
Miljan Puletic wrote:Hi Carey,
Since I am complete newbie, would you be willing to explaint a little bit more what these print statements do, I dont quite understand how those print statements determent which number is greater and which is smaller.
You might want to get an IDE like Eclipse, copy the code into it, and debug it - step through it line by line. If you don't know how to do that, there are tons of tutorials on that. Being able to step through your code in a debugger is critical to understanding and fixing code problems (logging being another).
Google (or Duck) the Java "printf" and read the documentation.
Try to write your own "printf" statement so you can see what it does.
That's how we all learn this stuff.
but I can save you the searching; try in the Java™ Tutorials or (2nd Tutorials section) and you will find the full details in the Formatter class documentation, though the latter will take ages to read.
Mike London wrote:. . . Google (or Duck) the Java "printf" and read the documentation. . . .
Why are you using one‑letter variable names? Did you copy them from somewhere (if so, please tell us where)? If you come back in six months you will not have the faintest idea what s m and k mean.