Skip to content

Instantly share code, notes, and snippets.

@tyanp
Last active August 29, 2015 14:13
Show Gist options
  • Save tyanp/feefe2beb3e086c04f85 to your computer and use it in GitHub Desktop.
Save tyanp/feefe2beb3e086c04f85 to your computer and use it in GitHub Desktop.
JK レイプ
public class aaa {
public static void main (String[] args) {
int ran = (int)(Math.random()*50)+1;
System.out.println("難易度を入力してください");
String line2=System.console().readLine();
int a=Integer.parseInt(line2);
int c=0;
switch (a) {
case 1:
c=30;
break;
case 2:
c=20;
break;
case 3:
c=10;
break;
}
System.out.println(c+"回以内に数字を当ててください");
for(int i=0; i<c; i++){
System.out.println("");
int n=Integer.parseInt(System.console().readLine());
if (n==ran){
System.out.println("正解です");
break;
}else if (n<ran){
System.out.println("小さいです");
}else{
System.out.println("大きいです");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment