herrDeng網內搜尋

自訂搜尋

Ads

2012年5月2日 星期三

請用Math.random產生int陣列

請用Math.random產生int陣列

45 則留言:

B10033045 提到...

public class hello2 {

public static void main(String[] args) {

int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(99*Math.random());
System.out.println(a[i]);
}


}
}

B10033052 提到...

import java.util.Random;
public class HELLO {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}

}

b10033037 提到...

public class pppp{
public static void main(String[] args) {
int [] a=new int[5];
for (int i=0;i<a.length;i++){
a[i]=(int)(Math.random()*99);
System.out.println("0-99亂數:"+a[i]);
}
}
}

B10033013 提到...

public class ost{
public static void main(String[] args) {
int [] a=new int[5];
for (int i=0;i<a.length;i++){
a[i]=(int)(Math.random()*99);
System.out.println("0-99亂數:"+a[i]);
}
}
}

B10033022 提到...

public class Hello502 {
public static void main(String[] args) {
int [] a=new int[5];
for (int i=0;i<a.length;i++){
a[i]=(int)(Math.random()*99);
System.out.println("0-99亂數:"+a[i]);
}
}
}

B10033054 提到...

public class asd{
public static void main(String[] args){
int[] a=new int[5];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(99*Math.random());
System.out.println(a[i]);
}
}
}

B10033054 提到...

public class asd{
public static void main(String[] args){
int[] a=new int[5];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

b10033039 提到...

import java.util.Random;
public class ags {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(100);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}
}

B10033001 提到...

import java.util.Random;
public class test {

static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}

}

B10033027 提到...

import java.util.Random;
public class hello {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}

}

B10033001 提到...

public class test {
public static void main(String[] args) {
int[] a = { 5, 7, 8, 2, 3 };
int temp;
for(int j=0;j<a.length;j++)
{
for(int i=0;i<a.length-1;i++)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
}
for(int i=0;i<a.length;i++)
{
System.out.println(a[i]);
}
System.out.println("MaxValue:"+a[4]);
System.out.println("MinValue:"+a[0]);
}

}

b10033025 提到...

public class hello{
public static void main(String[] args){
int[]a=new int [5];
for(int i=0;1<a.length;i++){
a[i]=(int)(Math.random()*99);
System.out.println("0~99亂數:"+a[i]);
}
}

}

B10033015 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i&lt;a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033004 提到...

import java.util.Random;
public class hello {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<a.length;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<a.length;i++)
{
System.out.println(a[i]);
}
}

}

B10033056 提到...

import java.util.Random;
public class hello {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<a.length;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<a.length;i++)
{
System.out.println(a[i]);
}
}

}

b9833163 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
⋯⋯ for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

b10033006 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
⋯⋯ for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033040 提到...

public class hello503{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

b10033025 提到...

public class XD{
static int min(int[] a){
int x=a[0];
for(int i=1;i<a.length;i++)
⋯⋯ {
if(x>a[i])
x=a[i];
}
return x;
}
static int max(int[] a){
int x=a[0];
for(int i=1;i<a.length;i++)
{
if(x<a[i])
x=a[i];
}
return x;
}
public static void main(String[] args){
int[] a={5,7,8,2,3};
System.out.println("min="+min(a));
System.out.println("max="+max(a));
}
}

b10033039 提到...

public class cc
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033009 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
⋯⋯ for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033014 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033035 提到...

public class test
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033010 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
⋯⋯ for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B9833080 提到...

public class random0503 {


public static void main(String[] args) {
// TODO code application logic here

int [] a=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println("0~99亂數:"+i+":"+a[i]);
}
}
}

B10033021 提到...

public class hello2
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033011 提到...

import java.util.Random;
public class hello503 {
public static void main(String[] args){
int[] a = new int[100];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+1+":"+a[i]);
}
System.out.println("++++++++++++++++++++++++++++++++++++++");
Random rnd=new Random();
for(int i=0;i<a.length;i++)
{
a[i]=rnd.nextInt(99);
System.out.println("0-99亂數:"+1+":"+a[i]);
}

}

}

B10033022 提到...

import java.util.*;
public class MaxNMin {
public static void main(String[] args) {
int [] a=new int[100];
for (int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+i+":"+a[i]);
}
System.out.println("+++++++++++++++++++++++++++++++");
Random rnd=new Random();
}
}

B10033043 提到...

public class test2
{
public static void main(String[] args)
{
int a[]=new int[5];
⋯⋯ for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033016 提到...

public class b33016
{
public static void main(String[] args){
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033020 提到...

public class hello2
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

b10033030 提到...

import java.util.*;
class bb {
public static void main (String[] args) {
int [] a= new int[100];
for (int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+i+":"+a[]);
}
}
}

B10033044 提到...

import java.util.*;
public class hello503 {
public static void main(String[] args) {
int [] a=new int[100];
for (int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+i+":"+a[i]);
}

}
}

B10033048 提到...

public class d
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B1003350 提到...

import java.util.*;
class bb {
public static void main (String[] args) {
int [] a= new int[100];
for (int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+i+":"+a[]);
}
}
}

B10033013 提到...

class test {
public static void main(String[] args) {
int[] a=new int[5];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

B10033013 提到...

class test {
public static void main(String[] args) {
int[] a=new int[5];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(100*Math.random());
System.out.println(a[i]);
}
}
}

b10033041 提到...

import java.util.*;
class a{
public static void main (String[] args)
int [] a=new int[100];
for (int i=0'i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"++":"+[i]);
}
System.out.println("+++++++++++++++++++++++++");
Random rnd=new Random();
for (int i=0;i<a.length;i++)
{
a[i]=rnd.nextInt(99);
System.out.println("0-99亂數:"+i":"a+[i]);
}
}

B10033005 提到...

import java.util.*;
public class qwe {

public static void main(String[] args) {
int [] a=new int[100];
for (int i=0;i<a.length; i++)
{
a[i]=(int) (Math.random()*100);

System.out.println("0-99亂數:"+i+":"+a[i]);
}
}
}

B10033003 提到...

import java.util.*;
public class asd {
public static void main(String[] args) {
int a[]=new int[100];
Random rnd=new Random();
for(int i=0;i<a.length;i++)
{
a[i]=rnd.nextInt(99);
System.out.println("0-99亂數:"+i+":"+a[i]);
}
}
}

B10033057 提到...

public class random
{
public static void main(String[] args)
{
int a[]=new int[5];
for (int i=0; i<a.length; i++)
{
a[i]=(int)(100*Math.random());
System.out.println("亂數0~99:"+a[i]);
}
}
}

B10033036 提到...

import java.util.Random;
public class hello503 {
public static void main(String[] args){
int[] a = new int[100];
for(int i=0;i<a.length;i++)
{
a[i]=(int)(Math.random()*100);
System.out.println("0-99亂數:"+1+":"+a[i]);
}
System.out.println("++++++++++++++++++++++++++++++++++++++");
Random rnd=new Random();
for(int i=0;i<a.length;i++)
{
a[i]=rnd.nextInt(99);
System.out.println("0-99亂數:"+1+":"+a[i]);
}

}

}

B10033002 提到...

import java.util.Random;
public class test {

static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}
}

B10033050 提到...

import java.util.Random;
public class HELLO {
public static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}

}

b10033028 提到...

import java.util.Random;
public class test {

static void main(String[] args) {
int[] a = new int[5];
Random rand=new Random();
for(int i=0;i<=4;i++)
{
a[i]=rand.nextInt(99);
}
for(int i=0;i<=4;i++)
{
System.out.println(a[i]);
}
}

}

Related Posts Plugin for WordPress, Blogger...

熱門文章