Skip to content

Instantly share code, notes, and snippets.

@takanakahiko
Last active August 29, 2015 14:12
Show Gist options
  • Save takanakahiko/d74bc66305d4ecc29834 to your computer and use it in GitHub Desktop.
Save takanakahiko/d74bc66305d4ecc29834 to your computer and use it in GitHub Desktop.
あけおめチャレンジ(1.1)
public class Akeome{
public static void main(String args[]){
String akeomeCheck = "";
String akeome[] = {"あ","け","お","め"};
int count = 0;
String moji = "";
System.out.print("\n\n");
while(!akeomeCheck.equals("あけおめ")){
moji = akeome[(int)(Math.random()*4)];
System.out.print(moji);
akeomeCheck += moji;
if(akeomeCheck.length() > 4)
akeomeCheck = akeomeCheck.substring(1);
count++;
}
System.out.print("\n\n\n\n");
System.out.println(count+"文字目であけおめできたよ!");
System.out.println("あけましておめでとう!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment