Last active
August 29, 2015 14:12
-
-
Save takanakahiko/d74bc66305d4ecc29834 to your computer and use it in GitHub Desktop.
あけおめチャレンジ(1.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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