masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
actually, it prints the first 102 prime numbers (if it works at all)...
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
public class Algarv {
public static void main(String args[]) {
int numbrid = 0; // Proovime kohe algusest
int loendur = 0; // Loendame üles, et pärast lihtsam oleks
while(loendur < 100) // Eelkontrolliga, t2idame kuni see on 100
{
numbrid++;
if(numbrid % 2 != 0)
{
int abi = 3;
while((numbrid % abi != 0)&&(abi <= ((numbrid - 1) / 2)))
{
abi++;
}
if(numbrid % abi != 0)
{
loendur++;
System.out.print(numbrid+" ");
System.out.println(loendur);
}
}
}
}
}
-ordi-
Junior Poster in Training
92 posts since Dec 2009
Reputation Points: 18
Solved Threads: 11
public class Algarv {
public static void main(String args[]) {
int numbrid = 0; // Proovime kohe algusest
int loendur = 0; // Loendame üles, et pärast lihtsam oleks
while(loendur < 100) // Eelkontrolliga, t2idame kuni see on 100
{
numbrid++;
if(numbrid % 2 != 0)
{
int abi = 3;
while((numbrid % abi != 0)&&(abi <= ((numbrid - 1) / 2)))
{
abi++;
}
if(numbrid % abi != 0)
{
loendur++;
System.out.print(numbrid+" ");
System.out.println(loendur);
}
}
}
}
}
For future reference, please have your comments in the code in English
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
:sigh: Closing this zombie now.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494