Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author anton
- */
- public class Ejercicio02 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Introduce un nΓΊmero: ");
- int num = Integer.parseInt(sc.nextLine());
- String[] cadenas = new String[num];
- for (int i = 0; i < num; i++) {
- System.out.println("Introduzca la cadena " + i + ": ");
- cadenas[i] = sc.nextLine();
- }
- }
- public static int cuentaVocales(String[] cadenas) {
- int resultado = 0;
- for (int i = 0; i < cadenas.length; i++) {
- if (cadenas[i].contains("a")
- || cadenas[i].contains("e")
- || cadenas[i].contains("i")
- || cadenas[i].contains("o")
- || cadenas[i].contains("u")) {
- resultado ++;
- }
- }
- return resultado;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement