herrDeng網內搜尋

自訂搜尋

Ads

2015年11月27日 星期五

ex9 產生10個亂數(0~99)計算平均值

產生10個亂數(0~99)計算平均值,亂數陣列要排序。

32 則留言:

a10433013 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

B10133007 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex02 { static void print(int[]x){ for(int j=0; j<x.length; j++) System.out.println(j+"-->"+x[j]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int[]x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

a10433029 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex11029 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd= new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("========="); print(x); System.out.println(sum); double average=(double)sum/x.length; System.out.println(average); }

}

A10433001 提到...

import java.security.SecureRandom;import java.util.Arrays;public class ex_02 { static void print(int []x){ for(int j=0;j<x.length;j++) System.out.println(j+"-->"+x[j]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0;i<x.length;i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }}

A10433006 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class z1127 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); }

public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av);

}

}

A10433008 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class z1127 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int[]x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("==============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433018 提到...

package f1;import java.security.SecureRandom;import java.util.*;public class n1 { static void print(int[] x){ for(int z=0;z<x.length;z++) System.out.println(z+"-->"+x[z]); } public static void main(String[] args) { SecureRandom sc=new SecureRandom(); int[] x=new int[10]; int sum=0; for(int i=0;i<x.length;i++){ x[i]=sc.nextInt(100); sum+=x[i];} print(x); Arrays.sort(x); System.out.println("==========================="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }}

A10433004 提到...

import java.security.SecureRandom;
import java.util.*;
public class ex1 {
static void print(int[]x){
for(int i=0; i<x.length; i++)
System.out.println(i+"-->"+x[i]);
}
public static void main(String[] args) {
SecureRandom rnd=new SecureRandom();
int []x=new int[10];
int sum=0;
for(int i=0; i<x.length; i++){
x[i]=rnd.nextInt(100);
sum+=x[i];
}
print(x);
Arrays.sort(x);
System.out.println("============");
print(x);
System.out.println(sum);
double av=(double)sum/x.length;
System.out.println(av);
}
}

A10433011 提到...

package zxc;

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int[]x){ for(int i=0; i<x.length;i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum = 0 ; for(int i=0; i<x.length;i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("================="); print(x); System.out.println(sum); double av = (double)sum/x.length; System.out.println(av); }

}

A10433011 提到...

package zxc;

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int[]x){ for(int i=0; i<x.length;i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum = 0 ; for(int i=0; i<x.length;i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("================="); print(x); System.out.println(sum); double av = (double)sum/x.length; System.out.println(av); }

}

A10433011 提到...

package zxc;

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int[]x){ for(int i=0; i<x.length;i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum = 0 ; for(int i=0; i<x.length;i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("================="); print(x); System.out.println(sum); double av = (double)sum/x.length; System.out.println(av); }

}

A10433024 提到...

import java.security.SecureRandom;import java.util.*;public class n1 { static void print(int[] x){ for(int z=0;z<x.length;z++) System.out.println(z+"-->"+x[z]); } public static void main(String[] args) { SecureRandom sc=new SecureRandom(); int[] x=new int[10]; int sum=0; for(int i=0;i<x.length;i++){ x[i]=sc.nextInt(100); sum+=x[i];} print(x); Arrays.sort(x); System.out.println("==========================="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }}

A10433003 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class A10433003 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { // TODO Auto-generated method stub SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("============"); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av);

}

}

A10433015 提到...



public class zxcva { static void print(int b []){ for(int i=0;i<b.length;i++) System.out.println(i+"---------"+b[i]); } public static void main(String[] args) { Random zxc = new Random(); int a =0; int[] b= new int[10]; for(int i=0;i<b.length;i++){ b[i]=zxc.nextInt(99); a+=b[i];} print(b); System.out.print(a); Arrays.sort(b); System.out.println("======="); print(b); double c=(double)a/b.length; System.out.println(c); }

A10433007 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433010 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433014 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433019 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433036 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433039 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433043 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433019 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433028 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

A10433038 提到...

import java.security.SecureRandom;import java.util.Arrays;



public class ex1 { static void print(int []x){ for(int i=0; i<x.length; i++) System.out.println(i+"-->"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }



}

A10433022 遲 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int []x){ for(int i=0; i"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("=============="); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }

}

A10433038 提到...

package zxc;

import java.security.SecureRandom;import java.util.Arrays;

public class ex1 { static void print(int[]x){ for(int i=0; i"+x[i]); } public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum = 0 ; for(int i=0; i<x.length;i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("================="); print(x); System.out.println(sum); double av = (double)sum/x.length; System.out.println(av); }

}

10433020 遲 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

A10433004 提到...

import java.security.SecureRandom;import java.util.Arrays;

public class A10433003 { static void print(int []x){ for(int i=0; i"+x[i]); } public static void main(String[] args) { // TODO Auto-generated method stub SecureRandom rnd=new SecureRandom(); int []x=new int[10]; int sum=0; for(int i=0; i<x.length; i++){ x[i]=rnd.nextInt(100); sum+=x[i]; } print(x); Arrays.sort(x); System.out.println("============"); print(x); System.out.println(sum); double av=(double)sum/x.length; System.out.println(av); }}

A10433021 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

A10433021 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

A10433021 提到 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

B10133189 提到...

import java.util.*;public class ex1 { static void print(int x[]){ for(int i=0;i<x.length;i++){ System.out.println(i+"----"+x[i]);} } public static void main(String[] args) { Random y=new Random(); int []x=new int[10]; int a=0; for(int i=0;i<x.length;i++){ x[i]=y.nextInt(99); a+=x[i];} print(x); Arrays.sort(x); System.out.println(); print(x); System.out.println(a); int b=a/x.length; System.out.println(b); }}

Related Posts Plugin for WordPress, Blogger...

熱門文章