JAVA : program menentukan bilangan sederhana
created by: Rachmat Ramadhan
package Do_While;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class menentukan_bilangan
{
public static void main(String[] args)
{
BufferedReader dataln=new BufferedReader
(new InputStreamReader (System.in));
String huruf=" ";
String ulangi = " ";
do{
System.out.print("masukan angka : ");
try{
huruf=dataln.readLine();
}
catch(IOException e){
System.out.println("error");
}
int x ;
x=Integer.parseInt(huruf);
if( x % 2 == 0 ) System.out.println (x + " adalah bilangan genap");
else System.out.println (x + " adalah bilangan ganjil");
System.out.print ("Apakah anda mau mengulang? ");
System.out.print("");
try{
ulangi=dataln.readLine();
}
catch (IOException e){
System.out.println("error");
}
x++;
}while(ulangi.equals("y") || ulangi.equals("Y"));
}
}