猜数字

package com.hanqi;

import java.util.Scanner;

public class test02 {

public static void main(String[] args) {
System.out.println("请您的数字:");

Scanner sc=new Scanner(System.in);

int a=sc.nextInt();

for(int i=0;i<20;i++){
System.out.println("请您猜数字:");
Scanner yc=new Scanner(System.in);

int b=yc.nextInt();
if(b>a){
System.out.println("您猜大了,请重新输入:");
}else if(b<a){
System.out.println("您猜小了,请重新输入:");
}
else{
System.out.println("恭喜您答对了!");
}
}
sc.close();



}

}

posted @ 2016-03-02 10:54  lizhe313  阅读(109)  评论(0编辑  收藏  举报