public class ST_WHILE {
public static void main(String[] args) {
int nCount = 0;
int i = args[0].length() - 1;
while(i >= 0)
{
char c = args[0].charAt(i);
System.out.println(c);
//コマンドライン引数の文字列中の母音の数
if(c == 'a' || c == 'A'){
nCount++;
System.out.println("Bingo");
}else if(c == 'i' || c == 'I'){
nCount++;
System.out.println("Bingo");
}else if(c == 'u' || c == 'U'){
nCount++;
System.out.println("Bingo");
}else if(c == 'e' || c == 'E'){
nCount++;
System.out.println("Bingo");
}else if(c == 'o' || c == 'O'){
nCount++;
System.out.println("Bingo");
}
--i;
}
System.out.println("nCount -> " + nCount);
}
}
|