Sebastien Zerbato

Greenhorn
+ Follow
since Nov 14, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sebastien Zerbato

hahaha. Point taken. I'll try and find out what the bug is..
9 years ago
it prints this out "2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 11 11 11 12 12 13 13 14 14 15 15 16 17 18 19 20 21 22 23 " so it doesn't work..
9 years ago
Oh ok,
so... Am I right ?
9 years ago
The thing is, I know it is wrong the right thing to do would be to directly start at the time you go into the loop. so I tried :

but obviously the error "variable may not have been initialized appeared. Aaand I'm stuck.
9 years ago

Paul Clapham wrote:No, that isn't quite right.

You didn't get it right because your variable names "i" and "j" don't mean anything so it's easy to get them confused. Which you did.

I always find it easier to think of an example while I am working on code. In your case:

2 4 6 8 10 ...

you don't want to start at 2, you want to start at 4. Likewise with

3 6 9 12 15 ...

you don't want to start at 3, you want to start at 6. Does a pattern start to appear?


Ok yeah I didn't see that part of the comment before weird.
And yeah I agree and that was what I tried to do by saying "2*i".
9 years ago
I now am officially brain-dead. I get what you mean by naming it nonPrime though but I don't see how that troubles my logic.
9 years ago
Point taken, but then what would you call them ?
9 years ago
ok not thinking right should it be more like this: ?
9 years ago
Ok, I get what you mean, Should it be ?
9 years ago
I did it found the error for the infinite loop thanks to you, : ) the code brings these number out for an input of 50: 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 4 8 12 16 20 24 28 32 36 40 44 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 7 14 21 28 35 42 8 16 24 32 40 9 18 27 36 45 10 20 30 40 11 22 33 44 12 24 36 13 26 39 14 28 42 15 30 45 16 32 17 34 18 36 19 38 20 40 21 42 22 44 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 so it appears to work, but I don't want it to take the first numbers for example 2,3,7. Do you have any idea of how to do that ?
9 years ago
Hello, I am trying to code this program that finds and prints out all the prime numbers between two numbers , it compiles fine but in the execution nothing happens, I am suspecting an infinite loop but cannot find the problem. Thank you for your time.
9 years ago
Ok, I will try that, thank you.
9 years ago
Hello, I am coding a program that is using a boolean array to select different values in a interval. All the values are originally set on true, then some values are assigned to false. Is there a way to select all the true values of that array ? I can't find one in the array API in java.
Thanks for your time.
9 years ago
I don't remember, I got blocked after that, and I realized the way I had approached the problem with was just way too complicated so I started from scratch again. My file now compiles and executes when tested with another program. Thank you for sparing me with your time.
9 years ago
Thank you everybody, I managed to find my mistakes. for now ;)
9 years ago