/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package deretbilangan;
/**
*
* @author Angga
*/
public class deretBilangan {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int[] deretBilGanjil = new int[10];
int[] deretBilGenap = new int[10];
int gnp=0, gjl=0;
for(int i=1; i<=20; i++){
if(i%2==1){
deretBilGanjil[gjl]=i;
gjl++;
}
else{
deretBilGenap[gnp]=i;
gnp++;
}
}
System.out.println("Deret Bilangan Ganjil : ");
for(int i=0; i<10; i++){
System.out.println("Bilangan Ganjil ke "+i+"="+deretBilGanjil[i]);
}
System.out.println("\n"+"Deret Bilangan Genap : ");
for(int i=0; i<10; i++){
System.out.println("Bilangan Genap ke "+i+"="+deretBilGenap[i]);
}
}
}