herrDeng網內搜尋

自訂搜尋

Ads

2015年5月18日 星期一

Ex7.猜數字0-9

Ex7.猜數字0-9

51 則留言:

D10333034 洪芷茵 提到...

D10333034 洪芷茵

import java.util.*;

public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");

}
System.out.println("x="+x);


}

}

D10333039邱嘉琪 提到...

import java.util.*;


public class D039 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
}

D10333012范秀娟 提到...

import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rcd=new Random();
Scanner input=new Scanner(System.in);
int x=rcd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0~9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

D10333040 王崇安 提到...

D10333040 王崇安
import java.util.*;
public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,....9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333009_張賢青 提到...

import java.util.*;

class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}

D10333030張佑榕 提到...

import java.util.*;


public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, ..., 10:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

D10233203邱秀蓉 提到...

import java.util.*;
public class ex01 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333008王旭翔 提到...

import java.util.Random;
import java.util.Scanner;
public class joneswang1314 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1 , 2,......,10:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("在大一點!");
else if(x<y)
System.out.println("在小一點!");}}}

D10333002徐國智 提到...

import java.util.*;
public class ex01 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333014邱宜貞 提到...

import java.util.*;
public class hello0518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜, 1, 2,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);
}
}

D10333015陳韻萱 提到...

import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0 , 1,2,...,9:");
y=input.nextInt();
if ( x==y)
System.out.print("猜對了!");
else if ( x>y)
System.out.print("再大一點!");
else
System.out.print("在小一點!");
}
System.out.print("x="+x);
}
}

D10333004 夏志明 提到...

import java.util.Random;
import java.util.*;
public class jimmy_0518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int a=rnd.nextInt(10);
int b=-1;
while(a!=b){
System.out.println("猜0,1,2,.....9:");
b=input.nextInt();
if(a==b)
System.out.println("猜對了");
else if(a>b)
System.out.println("再大一點");
else if(a<b)
System.out.println("再小一點");
}
System.out.println("A="+a);
}
}

D10333017廖俊齊 提到...

import java.util.Scanner;


public class bb123 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(100);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,99");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else
System.out.println("猜錯了!");
}
System.out.println("x="+x);

}

}

D10333007馮婷鈺 提到...

import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System .out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

Y10310054 潘幸德 提到...

import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

D10333013吳竑逸 提到...

import java.util.*;

public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10033029吳武俊 提到...

import java.util.Random;
import java.util.Scanner;


public class gtr {

public static void main(String[] args) {

Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10033305呂健宏 提到...

import java.util.*;
public class tx1 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小歇");
}
System.out.println("x="+x);
}

}

D10333013吳竑逸 提到...

import java.util.*;

public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333010 柯羿瑄 提到...

D10333010 柯羿瑄

import java.util.*;

public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");

}
System.out.println("x="+x);


}

}

D10333031張裕玲 提到...

import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if ( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");

}
System.out.println("x="+x);

}

}

D10333008王旭翔 提到...

import java.util.Random;
import java.util.Scanner;
public class joneswang1314 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=1;
while(x!=y){
System.out.println("猜0, 1 , 2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("在大一點!");
else if(x<y)
System.out.println("在小一點!");}}}

D10333022 劉俊谷 提到...

import java.util.*;
public class LOL {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

D10333033 江淑婷 提到...

D10333033 江淑婷
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);

}

}

D10333016 羅勝耀 提到...

import java.util.*;
public class hi123 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

Y10310066 陳昤瑄 提到...

Y10310066 陳昤瑄
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);

}

}

B10033104賴奕隆 提到...

import java.util.*;
public class B10033104 {
public static void main(String[]args){
Random rnd =new Random();
Scanner input =new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0~9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}

D10033093葉正傑 提到...

import java.util.Random;
import java.util.Scanner;


public class gtr {

public static void main(String[] args) {

Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333009_張賢青 提到...

import java.util.*;

class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (y>9 || y<0)
System.out.println("請輸入0-9");
else if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}

D10033305呂健宏 提到...

import java.util.*;
public class tx1 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極炸彈1~9");
y=input.nextInt();
if (y>9 || y<0)
System.out.println("不要鬧要輸入0~9");
else if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小些");
}
System.out.println("x="+x);
}

}

D10333003 提到...

import java.util.*;
public class hello518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}


}

D10333003盛采彤 提到...

import java.util.*;
public class hello518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}


}

D10333001 羅原福 提到...

package happ;
import java.util.*;
public class abc {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333041張晉豪 提到...

import java.util.Random;
import java.util.Scanner;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1 , 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D10333020徐瑞志 提到...

mport java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}

}

D10333020徐瑞志 提到...

mport java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}

}

呂秀娟D10333051 提到...

import java.util.Random;
import java.util.Scanner;


public class ex1 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點");
}
System.out.println("x="+x);

}

}

D10333037楊茗程 提到...

import java.util.*;
public class Promise {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!!!");
else if( x>y)
System.out.println("再大一點!!!");
else
System.out.println("再小一點!!!");
}
System.out.println("x="+x);
}

}

陳雅淇D10333052 提到...

import java.util.*;
public class ex1 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int X=rnd.nextInt(100);
int y=1;
while(X!=y){
System.out.println("猜0, 1 , 2,...,9:");
y=input.nextInt();
if( X==y)
System.out.println("猜對了!");
else if( X>y)
System.out.println("再大一點");
else
System.out.println("再小一點!");
}
System.out.println("x="+X);
}

}

D10033301江姿穎 提到...

import java.util.Random;
import java.util.Scanner;


public class gtr {

public static void main(String[] args) {

Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

匿名 提到...

D10033301江姿穎 提到...
import java.util.*;
public class tx1 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小歇");
}
System.out.println("x="+x);
}

}

D10133086范元譯 提到...

import java.util.*;

public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");

}
System.out.println("x="+x);


}

}

D10333026 汪子揚 提到...

mport java.util.*;

class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}

D10333019 提到...

public class d1033319 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}

D10033003陳志翔 提到...

import java.util.*;
public class D1003300333 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小些");
}
System.out.println("x="+x);
}
}

D10033203 提到...

D10033203 黃琮崴

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極炸彈1~9");
y=input.nextInt();
if (y>9 || y<0)
System.out.println("不要鬧要輸入0~9");
else if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小點");
}
System.out.println("x="+x);
}

}

D10033303 謝凱宇 提到...

import java.util.Random;
import java.util.Scanner;


public class gtr {

public static void main(String[] args) {

Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}

}

D9933084 陳睿喆 提到...


import java.util.*;

public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");

}
System.out.println("x="+x);


}

}

B10033077 陳光浩 提到...


import java.util.*;

public class hi {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");

}
System.out.println("x="+x);


}

}

D10333038歐俊吉 提到...

import java.util.*;
public class D10333038 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜看看密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("答對了");
else if( x>y)
System.out.println("數字再大些");
else
System.out.println("數字在小些");
}
System.out.println("x="+x);
}
}

20

D10033203黃琮崴 提到...

public class d10033203 {

public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}

Related Posts Plugin for WordPress, Blogger...

熱門文章