题解 | #判断是元音还是辅音#

判断是元音还是辅音

http://www.nowcoder.com/practice/7eb4df4d52c44d309081509cf52ecbc4

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String[] strs = {"A","a","E","e","I","i","O","o","U","u"};
        String str;
        while(sc.hasNext()) {
           str = sc.next();
            int i;
            for(i=0; i < strs.length ; i++) {
                if(strs[i].equals(str)){
                    System.out.println("Vowel");
                    break;
                }
            }
            if(i>=10) {
                System.out.println("Consonant");
            }
        }
    }
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
2025-11-27 10:04
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务