You try it first and post your best shot. You should know that a for loop is coded sometime similar to this: for(int i = 0; i < 5; i++). All you have to do is substitute the variables in what I just posted with what you posted.
First you understand how a for loop works.
Then understand all the pieces of the for loop expression.
Next, look at the posted code and figure out which of those pieces are there.
Put those pieces into the for loop syntax
I dont understand this.I have done other example.The code is suppose to convert 123456 to 654321 but i dont understand why i need y=y*10 and y+x %10.What is the modulus doing here???.These complications are preventing me from otherwise doing a straight-forward 'for' loop.
but i dont understand why i need y=y*10 and y+x %10
if you'd want to convert it you need to understand how the code works using the while loop first
My advice would be to trace the code by printing out the value of x and y in the loop after every operation or do it manually using a pen and paper
lastly take note of the initialization of variable y and x before the while loop,that should help you in the initializing content of the for loop
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...