THis is program in java for First 100 Prime Number as "count<100" .

``````public class PrimeNumber
{

public static void main(String args[])
{
int num=4;
int count=0;
System.out.println("First 100 Prime Number is: ");
System.out.println("1");
System.out.println("2");
System.out.println("3");
while(count<100)
{
num++;
if(num%2!=0)
{
int dv=3;
while((num%dv!=0)&&(dv<=((num-1)/2)))
{
dv++;
}
if(num%dv!=0)
{
count++;
System.out.println(num);
}
}
}

}
}
``````

actually, it prints the first 102 prime numbers (if it works at all)...

``````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);
}
}
}
}
}``````

1 is not technically a prime number either so it is not true to print it out as prime with two and three.

``````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);
}
}
}
}
}``````

``````//simple java program for finding prime nos of any range//
import java.io.*;

public static void main(String[] args) throws Exception{
int i,j;
System.out.println("Enter range:");
//int num=100;int num1=200;

System.out.println("Prime number: ");
for(i=1;i<num||i<num1;i++)
{
for (j=num; j<i; j++){
int n = i%j;
if (n==0){
break;
}
}
if(i == j){
System.out.print("  "+i);
}
}
}
}``````
``````java syntax(Toggle plain text)
import java.io.*;

public static void main(String[] args) throws Exception{
int i,j,count =0;
System.out.println("Enter range:");

System.out.println("Prime number: ");

for(i=num;i<num1;i++)
{
for (j=2; j<i; j++)
{
int n = i%2;
if (n==0)
{

break;
}
}
if(i == j)
{
System.out.print("  "+i);
}
}

}
}``````

import java.io.*;
public static void main(String args[])throws IOException{

int count=0;//count has to outside of "for"

for(int x=num1;x<num2;x++){
for(count=2;count<x;count++){

if(x%count==0){
break;
}

}
if(x==count){
System.out.print(x+",");

}
}

}
}
//9 isn't a prime number I fixed it so that it works properly

:sigh: Closing this zombie now.