tugas praktikum bilangan prima

package praktikum;

/**
*
* @author F1k4r
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

System.out.println(“.: MENAMPILKAN BILANGAN PRIMA :. “);
BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) );

int batas_awal;
int batas_akhir;
int hitung;

try{
System.out.println(“Masukkan batas awal : “);
batas_awal = Integer.parseInt(dataIn.readLine());

System.out.println(“Masukkan batas akhir : “);
batas_akhir = Integer.parseInt(dataIn.readLine());

System.out.println(“========================================================”);
System.out.println(“BILANGAN PRIMA”);
System.out.println(“========================================================”);

for(int i=batas_awal;i<=batas_akhir;i++){
hitung=0;
for(int a=1;a<=i;a++){
if(i%a==0){
hitung+=1;
}
}

if(hitung==2){
System.out.println(i);
}
}

}catch( IOException e ){
System.out.println(“Error!”);
}

}

}

Tugas 9 Kalkulus

Tugas kalkulus 4