Minggu, 24 Juni 2012

CONTOH SOURCE CODE ARRAY 1

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package array_buroro;

/**
 *
 * @author Masiti
 */
public class ARRAYSEARC {

    public static void main(String[] args) {
        int[] a = {3, 5, 6, 2, 4, 8, 9};
        for (int i = 0; i <= a.length - 1; i++) {
            if ((a[i] % 2) == 0) {
                System.out.println("even");
            } else {
                System.out.println("odd");
            }

        }

    }
}

Tidak ada komentar:

Poskan Komentar