import jeliot.io.*; public class Statistik { public static int nilai_Maksimum(int data[]) { int maks = data[0]; int n = data.length; int modus; for (int i=1; i<n; i++) if (maks < data[i]) { maks = data[i]; modus = i; } System.out.println("Modusnya adalah " + modus); return maks; } public static void hitung_Frekuensi() { int data[] = {1,1,2,2,2,2,2,3,3,4,5,5,5,5}; int i, n = data.length; int [] f = new int[10]; int nilai_terbesar; for (i=0; i<n; i++) ++f[data[i]]; for (i=0; i<10; i++) System.out.println("Data " + i + " sebanyak " + f[i]); nilai_terbesar = nilai_Maksimum(f); System.out.println("Dengan frekuensi = " + nilai_terbesar); } public static void main() { hitung_Frekuensi(); } }
0 Response for the "Statistik Java Jeliot"
Post a Comment