public class arraygenapganjil{
public static void main(String[]args){
int ar[]={5,3,7,2,9,17,8,67,46,43,13,10,76,27,83};
for (int i=0;i<15;i++){
System.out.println("ar ["+i+"] ==> "+ar[i]);
}
System.out.println("\nElemen ar[] Bernilai Ganjil\n");
for (int i=0;i<15;i++){
if (ar[i] % 2 != 0){
System.out.println("ar ["+i+"] ==> "+ar[i]);}
}
System.out.println("\nElemen ar[] Bernilai Genap\n");
for (int i=0;i<15;i++){
if (ar[i] % 2 == 0){
System.out.println("ar ["+i+"] ==> "+ar[i]);}
}
}}
Rabu, 11 Juni 2014
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar