herrDeng網內搜尋

自訂搜尋

Ads

2014年5月20日 星期二

產生亂數存於陣列並算平均

產生亂數存於陣列並算平均

29 則留言:

B10233067 提到...

package hello0520;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233067 提到...

package hello0520;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233089 提到...

package hello520;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [ ]a=new int[10];
double av;
int sum=0;
for (int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233082 唐偉強 提到...

package azazazaaza;
import java.util.*;
public class xasasasas {

public static void main(String[] args) {
Random rnd = new Random();
int a [] = new int[10];
double AV;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
AV=sum/a.length;
System.out.println("average="+AV);

}

}

Y10211064 黃耀葦 提到...

package bbbbbb;
import java.util.*;
public class aaaaa {

public static void main(String[] args) {
Random rnd = new Random();
int a [] = new int[10];
double AV;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
AV=sum/a.length;
System.out.println("average="+AV);

}

}

b10233095李元宏 提到...

package bbbbbbb;
import java.util.*;
public class bbbbbbb {

public static void main(String[] args) {
Random rnd = new Random();
int a [] = new int[10];
double AV;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
AV=sum/a.length;
System.out.println("average="+AV);

}

}

B10233091許少威 提到...

package dick;
import java.util.*;
public class vagina {
public static void main(String[] args) {
Random rnd = new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0; i<a.length; i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]"+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233062 黃聖評 提到...

package she1;
import java.util.*;
public class she12 {

public static void main(String[] args) {
Random rnd = new Random();
int[] a=new int[10];
double av;
int sum=0;
for(int i=0; i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];

}
av=(double)sum/a.length;
System.out.println("average="+av);
}

}

B10233110 提到...

package asd123;
import java.util.*;
public class zxc123 {

public static void main(String[] args) {
Random rnd = new Random();
int a [] = new int[10];
double AV;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
AV=sum/a.length;
System.out.println("average="+AV);

}

}

B10233092 提到...

package gang520;

import java.util.*;

public class ahq2014 {

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

}

B10233076 提到...

package hello;
import java.util.*;
public class ex1 {

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

B10233069連于傑 提到...

import java.util.Random;


public class Hello520 {

public static void main(String[] args) {
Random rnd=new Random();
int[] a=new int[10];
double av;
int sum=0;
for (int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];

}
av=(double)sum/a.length ;
System.out.println("average="+av);
}

}

Y10211027張君弘 提到...

package kkk;

import java.util.*;

public class kkkk {


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


}
}

10233068邱佳函 提到...

package hello;
import java.util.*;
public class exx1 {

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

B10233096 提到...

package dick;
import java.util.*;
public class vagina {
public static void main(String[] args) {
Random rnd = new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0; i<a.length; i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]"+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233108 林宣瑋 提到...

package laolin;
import java.util.*;
public class laolin0520ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233065 提到...

package hello0520;
import java.util.Random;
public class ex2 {
public static void main(String[] args) {
Random rnd = new Random();
int[] a= new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average"+av);
}

}

B10233081 藍立凱 提到...

package hello520;

import java.util.*;

public class ex1 {

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

}

}

B10233090 提到...

package tttt;
import java.util.*;
public class ccbb {

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

}

B10233097 邱宥甄 提到...

package asd;

import java.util.Random;

public class QQQ {

public static void main(String[] args) {
int [] a = new int[10] ;
Random rnd =new Random();
for(int i =0;i<a.length; i++){
a[i]=rnd.nextInt(100);
System.out.print(a[i]+"\t");
}
System.out.println();
for(int i =0; i<a.length-1;i++)
for(int j=0;j<a.length-1-i;j++)
if (a[j]>a[j+1]){
int tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
for(int i:a)
System.out.print(i+"\t");
System.out.println();

}

}

B10233072 黃君寰 提到...

package as;

import java.util.Random;

public class QQ {

public static void main(String[] args) {
int [] a = new int[10] ;
Random rnd =new Random();
for(int i =0;i<a.length; i++){
a[i]=rnd.nextInt(100);
System.out.print(a[i]+"\t");
}
System.out.println();
for(int i =0; i<a.length-1;i++)
for(int j=0;j<a.length-1-i;j++)
if (a[j]>a[j+1]){
int tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
for(int i:a)
System.out.print(i+"\t");
System.out.println();

}

}

B10233063 張宜禎 提到...

package hello0520;

import java.util.Random;

public class ex1 {

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

}

B10233084 陳億如 提到...

package hello0520;
import java.util.*;
public class ex1 {

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

B10233103 提到...

package zxc;
import java.util.*;
public class vvv {

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

}

B10233090 提到...

package tttt;
import java.util.*;
public class ccbb {

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

}

B10233079 提到...

package hello0520;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233109 提到...

package hello0520;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

B10233073 楊博宇 提到...

package rgrgrgrg12;
import java.util.*;
public class rgragarg {

public static void main(String[] args) {
Random rnd = new Random();
int a [] = new int[10];
double AV;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
AV=sum/a.length;
System.out.println("average="+AV);

}

}

B10233074 許逸憲 提到...

package hello0000;
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int [] a=new int[10];
double av;
int sum=0;
for(int i=0;i<a.length;i++){
a[i]=rnd.nextInt(100);
System.out.println("a["+i+"]="+a[i]);
sum+=a[i];
}
av=(double)sum/a.length;
System.out.println("average="+av);
}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章