标签:math system.in print input out logs code oid bsp
老王和隔壁的美女猜数字,一共有四次机会,猜到了就有特殊奖励
public class test { public static void main(String[] args) { int i=(int) (Math.random()*10); Scanner input=new Scanner(System.in); for(int j=0;j<4;j++){ System.out.println("老王第"+(j+1)+"次猜谜"); int l=input.nextInt(); if(l==i){ System.out.println("恭喜你猜对了"); break; }else{ continue; } } } }
标签:math system.in print input out logs code oid bsp
原文地址:http://www.cnblogs.com/fenghaichen/p/6869617.html