Re: Need some help with number diamond and explanation of code

Originally Posted by codyjava

Also could some help me understand what System.out.print((x >=n) ?+ x : + x); is actually doing.

You did write this code yourself, correct? I ask this because it is strange for someone to put something in their code and not know why. In any case, your construct above just prints out x. Same for the other uses of that statement.

Re: Need some help with number diamond and explanation of code

Originally Posted by jim829

You did write this code yourself, correct? I ask this because it is strange for someone to put something in their code and not know why. In any case, your construct above just prints out x. Same for the other uses of that statement.

What it means is:

(if conditional is true) ? do this : otherwise, do this.

Regards,
Jim

Hey Jim thanks for that answer and to answer your question I wrote all of it but the part I asked about. I found that from another example. Also do you have any input on the counting backwards part?

The problem is though I need it to display that backwards, so the numbers start shorter at the top and longer at the bottom. Also I'm just using the number 7 (int = 7), so this would only work if the user entered in the number 8. How could I get a number that changed fro the user input.