Don't mix int s and doubles in a for loop. double is not represented exactly, so this might cause off by one errors in the for loop. Instead work out how many iterations of the loop need to happen as an int, then use that value in the for loop.
Floating point types like double are stored as binary fractions - there are lots of values that don't work out exactly. For example 2.0 might really be 1.999999999999997 or it could be 2.000000000000003. In the former case, this code does 1 extra iteration: for (int i = 0; i < 2.0 ; i++)
Obviously it's not a problem if one enters 10.5, but one might be surprised by some numbers which one thinks is a whole number but isn't exactly that when it is converted to double. So in short it's not good practise.
what do you mean? about it being at the address above
So you now have 3 accounts that we know of, asking the same questions with exactly the same code. That's not good. Also combined with asking rather silly questions - it looks a lot like trolling. Reported
nope only one account. Reason why i have the same code is because i run the code. Then i do my own code. I change the whole thing. I just want to make sure i am in the right ball park when writing the code.