Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class hf_oktober09_01 {
- public static void main (String [] args){
- System.out.println("Írjon be egy szót, és megtudhatja mennyi magánhangzó van benne! ");
- char [] mgh = {'a', 'á', 'e', 'é', 'i', 'í', 'o', 'ó', 'ö', 'ő', 'u', 'ú', 'ü', 'ű'};
- int mghCount = 0;
- Scanner bill = new Scanner(System.in);
- String szo = bill.nextLine();
- for(int i=0; i<szo.length(); i++){
- for (int j=0; j<mgh.length; j++){
- if(Character.toLowerCase(szo.charAt(i)) == Character.toLowerCase(mgh[j])){
- mghCount++;
- }
- }
- }
- System.out.println("\nA '" + szo + "' " + mghCount + " magánhangzót tartalmaz. ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement