Script
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
readline.question(`dime cuantas filas quieres`, (rows) => {
readline.question(`dime cuantas columnas quieres`, (columns) => {
console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`)
let matrix = createMatrix(rows, columns)
printMatrix(matrix)
let minInfo = getMin(matrix)
console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`)
let maxInfo = getMax(matrix)
console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`)
readline.close()
public static int[] procesar(String[] p){
int[] r = new int[p.length];
for (int i = 0; i < p.length; i++) {
r[i] = contarVocales(p[i]);
}
return r;
}
public static List<Integer> countVocals(String[] words){
//genere otra matriz del mismo orden
List<Integer> count = new ArrayList<Integer>(words.length);
int countVoc = 0;
for (int i=0; i<words.length; i++){
countVoc = 0;
for (int j=0; j<words[i].length(); j++){
char ch = Character.toLowerCase(words[i].charAt(j));
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'){
countVoc += 1;
}
}
count.add(i, countVoc);
}
return count;
}
public static String [] contadorDeVocales(String [] cadenas){
String [] contador = new String [cadenas.lenght];
for (int i=0; i<cadenas.lenght; i++){
int contador = 0;
for (int j=0; j<cadenas[i].lenght; j++){
if (cadenas[i].charAt(j)=='a' || cadenas[i].charAt(j)=='e' || cadenas[i].charAt(j)=='i' || cadenas[i].charAt(j)=='o' || cadenas[i].charAt(j)=='u'){
contador++;
}
}
}
return contador;
}
public static String[] longitud(String[] array){
String[] result = new String[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = String.valueOf(array[i].length());
}
return result;
}
public int[][] shortMethod(String[][] matrix) {
int[][] result = new int[matrix.length][matrix[0].length];
for (int row = 0; row < matrix.length; row++)
for (int col = 0; col < matrix[0].length; col++)
result[row][col] = countVowels(matrix[row][col]);
return result;
}
public int countVowels(String word) {
int counter = 0;
for (int i = 0; i < word.length(); i++)
if (isVowel(word.charAt(i)))
counter++;
return counter;
}
public boolean isVowel(char letter) {
return letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u'
|| letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U';
}
private static void matriz(){
int filas, columnas, mayor=0, menor=0, posicionx=0, posiciony=0;
Scanner sc = new Scanner(System.in);
System.out.println("Ingrese el numero de filas");
filas = sc.nextInt();
System.out.println("Ingrese el numero de columnas");
columnas = sc.nextInt();
System.out.println("\n");
int matriz[][] = new int[filas][columnas];
for(int i=0; i<filas; i++){
for(int j=0; j<columnas; j++){
System.out.println("Ingrese el numero para la posicion "+ i +" "+ j);
matriz[i][j] = sc.nextInt();
if(matriz[i][j]>mayor){
mayor = matriz[i][j];
posicionx = i;
posiciony =
import java.io.*;
import java.util.Scanner;
public class Ejercicio5{
public static void main(String[] args) {
int numero, mayor = 0, menor = 0;
int x = 0, y = 0;
Scanner s = new Scanner(System.in);
System.out.print("Introduzca un numero: ");
numero = s.nextInt();
int[][] matriz = new int[numero][numero];
//Leemos los datos
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
System.out.print("Introduzca un numero para la posicion [" + i + "][" + j + "]: ");
matriz[i][j] = s.nextInt();
}
}
//Mostramos los datos
System.out.println("\nLa matriz es:");
public class QuantifyVowels {
public static int[] vowelsInEachWord(String[] words) {
int[] vowels = new int[words.length];
for (int i = 0; i < words.length; i++) {
int count = 0;
for (char c : words[i].toCharArray()) {
if (isVowel(c)) count++;
}
vowels[i] = count;
}
return vowels;
}
private static boolean isVowel(char c) {
return "aeiou".indexOf(c) != -1;
}
}
QuantifyVowels.vowelsInEachWord(new String[] {"pizza", "salsa", "huevo"});
public class Vowel {
public static void main(String[] args) {
String[][] array = {
{"hola", "como", "estas"},
{"buenos", "dias", "hola"},
{"hola", "como", "estas"}
};
int[][] result = vowelCount(array);
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(result[i][j] + " ");
}
System.out.println();
}
}
public static int[][] vowelCount(String[][] array) {
int[][] result = new int[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
result[i][j] = countVowels(
public static String[][] getVowelsAmount(String[][] strings){
int n = strings.length;
int m = strings[0].length;
String[][] res = new String[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
res[i][j] = countVowels(strings[i][j]);
}
}
return res;
}
public static String countVowels(String s){
int n = s.length();
int count = 0;
for (int i = 0; i < n; i++) {
char x = s.charAt(i);
if (x == 'a' || x == 'e' || x == 'i' ||
x == 'o' || x == 'u')
count++;
}
return Integer.toString(count);
}
// le paso un arreglo de string
// me retorna un array de Enteros
def contar_vocales(lista):
"""
Funcion que recibe una lista de strings y retorna una lista de enteros con la cantidad de vocales de cada string
"""
resultado = []
for i in lista:
# agrega a resultado la cantidad de vocales de i
resultado.append(len(re.findall('[aeiou]', i)))
return resultado
public static char[] arrayVocals(char[] arrayWords) {
char[] arrayVocals = new char[arrayWords.length];
for(int i=0;i<arrayWords.length;i++) {
for(int j=0;j<arrayWords[i].length();j++) {
if(arrayWords[i][j]=='a'|| arrayWords[i][j]=='e'|| arrayWords[i][j]=='i'||arrayWords[i][j]=='o'||arrayWords[i][j]=='u' || arrayWords[i][j]=='A'|| arrayWords[i][j]=='E'|| arrayWords[i][j]=='I'||arrayWords[i][j]=='O'||arrayWords[i][j]=='U') {
arrayVocals[i]++;
}
}
}
return arrayVocals;
}
public class MaxMin {
static int max = 0;
static int min = 0;
static int posMaxi = 0;
static int posMaxj = 0;
static int posMini = 0;
static int posMinj = 0;
public static void main(String[] args) {
int[][] matrix = { { 1, 2, 3, 4, 5, 6 },
{ 7, 8, 9, 10,11,12 },
{ 13,14,15,16,17,18 } };
System.out.println("matrix: ");
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
System.out.print(matrix[i][j] + " ");
}
System.out.println();
}
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix
// Java program to find largest and smallest
// elements in a matrix
import java.io.*;
class GFG {
static void findLargestAndSmallest(int matrix[][],
int row, int col)
{
int largest = Integer.MIN_VALUE;
int smallest = Integer.MAX_VALUE;
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
if (matrix[i][j] > largest)
{
largest = matrix[i][j];
}
if (matrix[i][j] < smallest)
{
smallest = matrix[i][j];
}
}
}
System.out.println("Largest element : " + largest);
System.out.println("Smallest element : " + smallest);
}
// driver code
public static void main (String[] args)
{
int matrix[][] = {
public static String[][] filter(String[][] matrix){
int cantVocal = 0;
String[][] vocal = new String[matrix.length][matrix[0].length];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
for (int k = 0; k < matrix[i][j].length(); k++) {
if (isVowel(matrix[i][j].charAt(k))){
cantVocal++;
}
}
vocal[i][j] = String.valueOf(cantVocal);
cantVocal = 0;
}
}
return vocal;
}
def count_vowels(words):
vowels = {'a', 'e', 'i', 'o', 'u'}
new_words = []
for word in words:
count = 0
for letter in word:
if letter in vowels:
count += 1
new_words.append(count)
return new_words
count_vowels(['hello', 'world'])
package ejercicio_ciclos;
import java.util.Scanner;
public class Ejercicio_Ciclos {
public static void main(String[] args) {
Scanner lector=new Scanner(System.in);
int filas,columnas;
System.out.println("Ingrese la cantidad de filas de la matriz");
filas= lector.nextInt();
System.out.println("Ingrese la cantidad de columas de la matriz");
columnas= lector.nextInt();
System.out.println("");
int matriz[][]=new int [filas][columnas];
int filas_sum[]=new int[filas];
int columnas_sum[]=new int[columnas];
int suma_filas=0;
int suma_columnas=0;
for(int i=0;i<filas;i++){
for(int j=0;j<columnas;j++){
System
Script
function countVowels(arr) {
const vowels = ["a", "e", "i", "o", "u"];
return arr.map(word => {
return word.split("").reduce((acc, letter) => {
return vowels.includes(letter) ? acc + 1 : acc;
}, 0);
});
}
console.log(countVowels(["amarillo", "azul", "rojo", "verde"]));
def vowels(matrix):
result = []
for i in range(len(matrix)):
result.append([])
for j in range(len(matrix[i])):
result[i].append(len([c for c in matrix[i][j] if c in ['a', 'e', 'i', 'o', 'u']]))
return result
public static String[] metodo2(String[] matriz) {
for (int i = 0; i < matriz.length; i++) {
char[] vocales = {'a', 'e', 'i', 'o', 'u'};
int contador = 0;
for (int j = 0; j < matriz[i].length(); j++) {
for (int k = 0; k < vocales.length; k++) {
if (Character.toLowerCase(matriz[i].charAt(j)) == vocales[k]) {
contador++;
}
}
}
matriz[i] = matriz[i] + contador;
}
return matriz;
}
def max_min(m):
max_row = max(m[0])
max_col = max(m[1])
min_row = min(m[0])
min_col = min(m[1])
return max_row, max_col, min_row, min_col
max_min([[10, 2, 3], [4, 5, 6], [7, 8, 9]])
String[] vowels = {"a", "e", "i", "o", "u"};
public int[] countVowels(String[] array) {
int[] vowelsCount = new int[array.length];
for(int i = 0; i < array.length; i++) {
String str = array[i];
int count = 0;
for(int j = 0; j < str.length(); j++) {
for(int k = 0; k < vowels.length; k++) {
if(str.charAt(j) == vowels[k].charAt(0)) {
count++;
}
}
}
vowelsCount[i] = count;
}
return vowelsCount;
}
import java.util.Scanner;
public class Matriz{
public static void main(String[] args) {
int filas, columnas;
Scanner s = new Scanner(System.in);
System.out.println("Ingrese el numero de filas de la matriz");
filas = s.nextInt();
System.out.println("Ingrese el numero de columnas de la matriz");
columnas = s.nextInt();
int matriz[][] = new int[filas][columnas];
int mayor = matriz[0][0];
int menor = matriz[0][0];
//Rellenando la matriz
for (int i = 0; i < filas; i++) {
for (int j = 0; j < columnas; j++) {
System.out.println("Ingrese un valor para la posicion "+i+","+j);
matriz[i][j] = s.nextInt();
int[][] matrix = new int[3][3];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++){
System.out.println("Enter a matrix[" + i + "][" + j + "]: ");
matrix[i][j] = input.nextInt();
}
}
public static void main(String[] args) {
Scanner leer = new Scanner(System.in);
int matriz[][];
int filas, col;
System.out.print("Ingrese el numero de filas: ");
filas = leer.nextInt();
System.out.print("Ingrese el numero de columnas: ");
col = leer.nextInt();
matriz = new int[filas][col];
for (int i = 0; i < filas; i++) {
for (int j = 0; j < col; j++) {
System.out.print("Ingrese el elemento ["+i+"]["+j+"]: ");
matriz[i][j] = leer.nextInt();
}
}
int sumaFila[] = new int[filas];
int sumaCol[] = new int[col];
for (int i = 0; i < filas; i++) {
for (int j
public class Matriz {
public static void main(String[] args) {
int filas = 0, columnas = 0;
Scanner sc = new Scanner(System.in);
System.out.print("Ingrese el numero de filas: ");
filas = sc.nextInt();
System.out.print("Ingrese el numero de columnas: ");
columnas = sc.nextInt();
int[][] matriz = new int[filas][columnas];
int[] sumaFilas = new int[filas];
int[] sumaColumnas = new int[columnas];
for(int i=0; i<filas; i++) {
for(int j=0; j<columnas; j++) {
System.out.print("Ingrese el elemento ["+i+"] ["+j+"] :");
matriz[i][j] = sc.next
String[] agregarVocales(String[] palabras) {
String[] palabrasConVocales = new String[palabras.length];
for (int i = 0; i < palabras.length; i++) {
int cantidadVocales = 0;
for (int j = 0; j < palabras[i].length(); j++) {
if (palabras[i].charAt(j) == 'a' || palabras[i].charAt(j) == 'e'
|| palabras[i].charAt(j) == 'i' || palabras[i].charAt(j) == 'o'
|| palabras[i].charAt(j) == 'u') {
cantidadVocales++;
}
}
palabrasConVocales[i] = palabras[i] + " tiene " + cantidadVocales + " vocales";
}
return palabrasConVocales;
}
public static int[][] cantidadVocales (String[][] matriz) {
int[][] respuesta = new int[matriz.length][matriz[0].length];
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
String palabra = matriz[i][j];
int cantidadVocales = 0;
for (int k = 0; k < palabra.length(); k++) {
char caracter = palabra.charAt(k);
if (caracter == 'a' || caracter == 'e' || caracter == 'i' || caracter == 'o' || caracter == 'u') {
cantidadVocales++;
}
}
respuesta[i][j] = cantidadVocales;
}
}
return respuesta;
}
public class Matriz {
private int matriz[][];
private int filas;
private int columnas;
private int mayor;
private int menor;
private int posicionmayor;
private int posicionmenor;
Matriz(int n, int m) {
this.matriz = new int[n][m];
this.filas = n;
this.columnas = m;
this.mayor = 0;
this.menor = 0;
this.posicionmayor = 0;
this.posicionmenor = 0;
}
void llenarMatriz() {
for (int i = 0; i < filas; i++) {
for (int j = 0; j < columnas; j++) {
matriz[i][j] = (int) (Math.random() * 100);
}
}
}
void mostrarMatriz() {
for (int i = 0; i < filas; i++) {
for
import numpy as np
n = int(input("Ingrese el número de filas: "))
m = int(input("Ingrese el número de columnas: "))
A = np.random.randint(-100,100,(n,m))
print("A=\n", A)
pos_min = A.argmin()
pos_max = A.argmax()
fila_min = pos_min // n
col_min = pos_min % m
fila_max = pos_max // n
col_max = pos_max % m
print("\nEl valor mínimo es: ", A[fila_min,col_min])
print("Se encuentra en la fila: ", fila_min + 1)
print("y en la columna: ", col_min + 1)
print("\nEl valor máximo es: ", A[fila_max,col_max])
print("Se encuentra en la fila: ", fila
Script
const countVowels = (matrix) => {
const resultMatrix = [];
for (let i = 0; i < matrix.length; i++){
for (let j = 0; j < matrix[i].length; j++){
var count = 0;
for (let k = 0; k < matrix[i][j].length; k++){
if (matrix[i][j][k].match(/[aeiou]/gi)){
count++;
}
}
resultMatrix.push(count);
}
}
return resultMatrix;
}
Script
function add(a, b) {
return a + b;
}
add(1, 2);
static boolean buscarAlumno(Scanner sc, ArrayList<String> nombres) {
System.out.print("Ingrese nombre del alumno a buscar:");
String nombre = sc.next();
return nombres.contains(nombre);
}
public static void main(String[] args) {
ArrayList<String> alumnos = new ArrayList<String>();
alumnos.add("Juan");
alumnos.add("Pedro");
alumnos.add("Carlos");
alumnos.add("Maria");
alumnos.add("Luisa");
System.out.println("Existe? " + buscarAlumno(new Scanner(System.in), alumnos));
}
public static int[] cantidad_vocales(String[] palabras){
int[] cant_vocales = new int[palabras.length];
for (int i = 0; i < palabras.length; i++) {
cant_vocales[i] = palabras[i].split("[bcdfghjklmnñpqrstvwxyz]", -1).length - 1;
}
return cant_vocales;
}
public static int[] convertirVector(int[][] matriz) {
int[] vector = new int[matriz.length * matriz[0].length];
int posicion = 0;
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
vector[posicion] = matriz[i][j];
posicion++;
}
}
return vector;
}
String[] resultado = new String[matriz.length];
for (int i = 0; i < matriz.length; i++) {
String palabra = matriz[i];
int numeroVocales = 0;
for (int j = 0; j < palabra.length(); j++) {
if (palabra.charAt(j) == 'a' || palabra.charAt(j) == 'e' || palabra.charAt(j) == 'i' || palabra.charAt(j) == 'o' || palabra.charAt(j) == 'ú') {
numeroVocales++;
}
}
resultado[i] = palabra + ": " + numeroVocales;
}
return resultado;
}
public int[][] contarVocales(String[][] array){
int[][] contador = new int[array.length][array[0].length];
for(int i=0; i<array.length; i++){
for(int j=0; j<array[0].length; j++){
contador[i][j] = contarVocales(array[i][j]);
}
}
return contador;
}
public int contarVocales(String cadena){
int contador = 0;
String[] vocales = {"a", "e", "i", "o", "u"};
for(int i=0; i<vocales.length; i++){
contador += contarOcurrencias(cadena, vocales[i]);
}
return contador;
}
public int contarOcurrencias(String cadena, String ocurrencia){
int contador = 0;
int indice = 0;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int rows, cols;
System.out.println("Rows: ");
rows = keyboard.nextInt();
System.out.println("Cols: ");
cols = keyboard.nextInt();
int[][] matrix = new int[rows][cols];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
System.out.println("Enter value for position " + i + " " + j);
matrix[i][j] = keyboard.nextInt();
}
}
keyboard.close();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
System.out.print(matrix[i][j] + " ");
}
System.out
public class Matriz {
int[][] matriz = new int[3][3];
public void leer(){
for(int i = 0; i < matriz.length; ++i){
for(int j = 0; j < matriz[i].length; ++j){
System.out.print("ingrese el numero (" + i + "," + j + "):");
matriz[i][j] = Integer.parseInt(System.console().readLine());
}
}
}
public void escribir(){
for(int i = 0; i < matriz.length; ++i){
for(int j = 0; j < matriz[i].length; ++j){
System.out.print(matriz[i][j] + " ");
}
System.out.println();
}
}
public void mayor(){
int m = 0
class Matriz {
public static void main(String[] args) {
int[][] matriz = new int[3][4];
int mayor = 0, menor = 0;
int x = 0, y = 0;
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
matriz[i][j] = (int)(Math.random() * 100 + 1);
System.out.print(matriz[i][j] + "\t");
if (matriz[i][j] > mayor) {
mayor = matriz[i][j];
x = i;
y = j;
}
if (matriz[i][j] < menor) {
Script
function add(a, b) {
return a + b
}
add(1, 2)
public void problema3(String[] cadenas)
{
int[] vocales = new int[cadenas.length];
for (int i = 0; i < cadenas.length; i++) {
int count = 0;
for (int j = 0; j < cadenas[i].length(); j++) {
switch(cadenas[i].charAt(j))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
count++;
break;
default:
break;
}
}
vocales[i] = count;
}
}
Script
var max = 0
var min = 0
var rowMax = 0
var colMax = 0
var rowMin = 0
var colMin = 0
var row = 0
var col = 0
var matriz = []
function genMatrix(row, col) {
var matriz = []
for (let i = 0; i < row; i++) {
matriz[i] = []
for (let j = 0; j < col; j++) {
matriz[i][j] = Math.floor(Math.random() * 100)
}
}
return matriz
}
function printMatrix(matriz) {
var str = ''
for (let i = 0; i < matriz.length; i++) {
for (let j = 0; j < matriz[i].length; j++) {
str += matriz[i][j] + ' '
}
console.log(str)
str = ''
}
}
function getMaxMin(matriz) {
var
public class Matriz {
public static void main(String[] args) {
String[][] matriz = new String[][]{{"a","b","c"}, {"d","e","f"}, {"g","h","i"}};
int[][] cantidad = new int[3][3];
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
cantidad[i][j] = cuantasVocales(matriz[i][j]);
}
}
System.out.println(Arrays.deepToString(cantidad));
}
private static int cuantasVocales(String s) {
int vocales = 0;
for (int i = 0; i < s.length(); i++) {
if (esVocal(s.charAt(i))) {
vocales += 1;
}
}
return vocales;
}
public static void main(String[] args) {
// TODO code application logic here
String[] cadenas = {"hola","mundo","como","estas"};
System.out.println(Arrays.toString(cantidad_vocales(cadenas)));
}
public static int[] cantidad_vocales(String[] cadenas){
int[] cantidad = new int[cadenas.length];
int j = 0;
for(String cadena: cadenas){
int i = 0;
for(int x = 0;x<cadena.length();x++){
if("aeiouAEOIU".indexOf(cadena.charAt(x)) != -1)
i++;
}
cantidad[j] = i;
j++;
}
return cantidad;
}
public class Ejercicio43 {
//main
public static void main(String[] args) {
int[][] matriz = {{1,2,3},{4,5,6},{7,8,9}};
int mayor = 0;
int menor = 0;
for(int i = 0; i < matriz.length; i++) {
for(int j = 0; j < matriz[i].length; j++) {
System.out.print(matriz[i][j] + " ");
if(matriz[i][j] > mayor) {
mayor = matriz[i][j];
}
if(matriz[i][j] < menor) {
menor = matriz[i][j];
}
}
System.out.println();
}
System.
/*
@param array: array of Strings
@return array: array of length of each word
*/
public int[] countVowels(String[] array){
int[] vowels = new int[array.length];
for (int i = 0; i < array.length; i++) {
vowels[i] = array[i].length();
}
return vowels;
}
public static String[] contadorDeVocales(String[] a) {
String[] b = new String[a.length];
for (int i = 0; i < a.length; i++) {
int c = 0;
for (int j = 0; j < a[i].length(); j++) {
if (a[i].charAt(j) == 'a' || a[i].charAt(j) == 'e'
|| a[i].charAt(j) == 'i' || a[i].charAt(j) == 'o'
|| a[i].charAt(j) == 'u') {
c++;
}
}
b[i] = "" + c;
}
return b;
}
public static void main(String[] args) {
String[] a = {"hola", "me", "llamo", "nacho";
String[] b = new String[4];
for (int i = 0; i < a.length; i++) {
int c = 0;
for (int j = 0; j < a[i].length(); j++) {
if (a[i].charAt(j) == 'a' || a[i].charAt(j) == 'e' || a[i].charAt(j) == 'i'|| a[i].charAt(j) == 'o' || a[i].charAt(j) == 'u') {
c++;
}
}
b[i] = String.valueOf(c);
}
}
public class Matriz {
public static void main(String[] args) {
int i,j,n,m;
int mayor, menor;
int posicionf, posicionc;
Scanner teclado=new Scanner(System.in);
System.out.println("Ingrese la cantidad de filas: ");
n = teclado.nextInt();
System.out.println("Ingrese la cantidad de columnas: ");
m = teclado.nextInt();
int matriz[][]=new int[n][m];
for(i=0;i<n;i++){
for(j=0;j<m;j++){
System.out.print("Ingrese el valor de la posicion ["+i+"]["+j+"]: ");
matriz[i][j]=teclado.nextInt();
}
}
System.out.println("La matriz ingresada es:");
for(i=
public void ejercicio3(String[][] matriz)
{
String[][] resultado = new String[matriz.length][matriz.length];
for (int i = 0; i < matriz.length; i++)
{
for (int j = 0; j < matriz.length; j++)
{
resultado[i][j] = String.valueOf(matriz[i][j].replaceAll("[^aeiouAEIOU]", "").length());
}
}
for (int i = 0; i < matriz.length; i++)
{
for (int j = 0; j < matriz.length; j++)
{
System.out.print("[" + resultado[i][j] + "]");
}
System.out.println("");
}
}
public void ejecutarEjercicio3()
{
String[][] matriz = new String[3][3];
matriz[0][0]
String[] palabras = {"juana", "reyna", "chileno", "zaragoza"};
String[] contador = contador(palabras);
//string[] contador = {"2", "2", "3", "3"};
public void metodo(String[] str){
String[] str2 = new String[str.length];
for(int i=0; i<str.length; i++){
str2[i] = String.valueOf(contarVocales(str[i]));
}
}
public int contarVocales(String str){
int counter = 0;
Pattern pattern = Pattern.compile("[aeiouAEIOU]");
Matcher matcher = pattern.matcher(str);
while(matcher.find()){
counter++;
}
return counter;
}
def leer_matriz():
matriz = []
for i in range(3):
matriz.append([0]*3)
return matriz
def leer_valores(matriz, n, m):
for i in range(n):
for j in range(m):
matriz[i][j] = int(input("Digite un numero para la posicion: " + str(i) + ", " + str(j) + ": "))
def imprimir_matriz(matriz, n, m):
for i in range(n):
for j in range(m):
print(matriz[i][j], end=" ")
print()
def encontrar_mayor(matriz, n, m):
max = matriz[0][0]
for i in range(n):
for j in range(m):
if(matriz[i][j] > max):
max = matriz[i][j]
return max
def enc
public String[] countVowelsInArray(String[] array){
String[] result = new String[array.length];
for(int i = 0; i<array.length; i++){
result[i] = array[i].length();
}
return result;
}
public class VocalCounter{
public static void main(String[] args) {
String[] s = new String[] {"Hola", "Que", "Tal", "Estas"};
String[] r = countVowels(s);
printArray(r);
}
public static String[] countVowels(String[] s) {
String[] o = new String[s.length];
for (int i = 0; i < s.length; i++) {
o[i] = String.valueOf(countVowels(s[i]));
}
return o;
}
public static int countVowels(String s) {
int vocales = 0;
String[] aS = new String[] { "a", "e", "i", "o", "u" };
for (int i = 0; i < aS.length; i++) {
int index = s.indexOf(aS[i]);
int count = 0;
while (index != -1) {
count++;
private static void contarVocales(String[] palabras){
String[] cantidadPalabras = new String[palabras.length];
for(int i=0; i<palabras.length;i++){
cantidadPalabras[i]=palabras[i].replaceAll("[^aeiouAEIOU]","").length();
}
}
Script
function generarMatrizVocales(matriz){
var arrayVocales = [];
var arrayCadenas = [];
var contadorVocales = 0;
for(var i = 0; i < matriz.length; i++){
arrayCadenas = matriz[i].split("");
for(var j = 0; j < arrayCadenas.length; j++){
if(arrayCadenas[j] == "a" || arrayCadenas[j] == "e" || arrayCadenas[j] == "i" || arrayCadenas[j] == "o" || arrayCadenas[j] == "u"){
contadorVocales++;
}
}
arrayVocales.push(contadorVocales);
contadorVocales = 0;
}
return arrayVocales;
}
public static int[] contarVocales(String[] palabras){
int[] cantidadDeVocales = new int[palabras.length];
for(int i = 0; i < palabras.length; i++){
char[] palabra = palabras[i].toCharArray();
for(int j = 0; j < palabra.length; j++){
if(palabra[j] == 'a' || palabra[j] == 'e' || palabra[j] == 'i' || palabra[j] == 'o' || palabra[j] == 'u'){
cantidadDeVocales[i]++;
}
}
}
return cantidadDeVocales;
}
// Java
public static String[] countVowels(String[] words) {
String[] result = new String[words.length];
for(int i = 0; i < words.length; i++) {
String word = words[i];
int vowels = 0;
for(int j = 0; j < word.length(); j++) {
char letter = word.charAt(j);
if(letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u') {
vowels++;
}
}
result[i] = vowels.toString();
}
return result;
}
// Ruby
def count_vowels(words)
words.map do |word|
word.count('aeiou')
end
end
// Python
def countVowels(words):
return [sum(1 for c in word if c in 'aeiou') for word in words]
def vocales(matriz_Strings):
vocales = 0
for i in range(len(matriz_Strings)):
for j in range(len(matriz_Strings[i])):
if(matriz_Strings[i][j] == "a" or matriz_Strings[i][j] == "e" or matriz_Strings[i][j] == "i" or matriz_Strings[i][j] == "o" or matriz_Strings[i][j] == "u"):
vocales = vocales + 1
return vocales
matriz_Strings = [["Hola","mundo"], ["Hola","mundo"], ["Hola","mundo"], ["Hola","mundo"], ["Hola","mundo"]]
vocales(matriz_Strings)
//Pseudocode
def function2(matrix):
n = matriz.length
m = matriz[0].lenght
//Se calcula la matriz resultante
for i in range(n):
for j in range(m):
if i%3==0 and j%2==0:
matrix[i][j] = matrix[i][j] * 5
return matrix
public static int[] ejercicio5(String[] palabras) {
int[] cantVocales = new int[palabras.length];
for (int i = 0; i < palabras.length; i++) {
cantVocales[i] = 0;
for (int j = 0; j < palabras[i].length(); j++) {
if (palabras[i].charAt(j) == 'a' || palabras[i].charAt(j) == 'e'
|| palabras[i].charAt(j) == 'i' || palabras[i].charAt(j) == 'o'
|| palabras[i].charAt(j) == 'u') {
cantVocales[i]++;
}
}
}
return cantVocales;
}
int[][] matrix = {{1,2,3}, {4,5,6}, {7,8,9}};
public static String[] contarVocales(String[] palabras){
String[] contadorVocales = new String[palabras.length];
for (int i=0; i < palabras.length; i++){
contadorVocales[i] = String.valueOf(palabras[i].replaceAll("[^aeiouAEIOU]", "").length());
}
return contadorVocales;
}
Script
function (array) {
var result = [];
var vowels = ['a', 'e', 'i', 'o', 'u'];
for (var x = 0; x < array.length; x++) {
var word = array[x].toLowerCase().split('');
var count = 0;
for (var y = 0; y < word.length; y++) {
if (vowels.includes(word[y])) {
count++;
}
}
result.push(count);
}
console.log(result);
}
Script
function vocales(a) {
var b = [];
for (let i = 0; i < a.length; i++) {
b.push(a[i].match(/[aeiou]/gi).length);
}
return b;
}
vocales(["hola", "adios"])
import java.util.Arrays;
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of the matrix");
int size = scanner.nextInt();
int[][] matrix = new int[size][size];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
System.out.println("Enter the value of position " + i + "," + j);
matrix[i][j] = scanner.nextInt();
}
}
System.out.println(Arrays.deepToString(matrix));
int minElement = matrix[0][0];
int maxElement = matrix[0][0];
int[] minPosition = new int[] {0, 0};
int[] maxPosition = new int[] {0, 0};
for (int i = 0; i < size; i
static int[][] mutiplyBy5(int[][] array){
int[][] newArray = new int[array.length][array[0].length];
for(int i = 0; i < array.length; i++){
for(int j = 0; j < array[i].length; j++){
newArray[i][j] = array[i][j] * 5;
}
}
return newArray;
}
Script
L = 8
W = 5
print "The area is", L*W
void main() {
int[][] matriz = {{1, 2, 3}, {4, 5, 6}};
int mayor = matriz[0][0];
int menor = matriz[0][0];
int posicion1 = 0;
int posicion2 = 0;
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if (mayor < matriz[i][j]) {
mayor = matriz[i][j];
posicion1 = i;
posicion2 = j;
}
if (menor > matriz[i][j]) {
menor = matriz[i][j];
posicion1 = i;
posicion2 = j;
}
}
}
}
Script
const array1 = [
"Hello",
"world",
"I",
"am",
"a",
"software",
"engineer"
];
let countVowels = arr => {
return arr.map(word => {
let count = 0;
word.split("").forEach(letter => {
if (
letter === "a" ||
letter === "e" ||
letter === "i" ||
letter === "o" ||
letter === "u"
) {
count++;
}
});
return count;
});
};
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int matriz[][] = new int[4][4];
int aux = 0;
int aux2 = 0;
int mayor = 0;
int menor = 0;
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
matriz[i][j] = (int) (Math.random() * 10);
System.out.print(matriz[i][j] + " ");
}
System.out.println(" ");
}
menor = matriz[0][0];
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
if (matriz[i][j] > mayor)
public int[][] contarVocales(String[][] a){
int[][] contador = new int[a.length][a[0].length];
for (int i = 0; i < contador.length; i++) {
for (int j = 0; j < contador[i].length; j++) {
String palabra = a[i][j];
if (palabra != null) {
palabra = palabra.toLowerCase();
for (int k = 0; k < palabra.length(); k++) {
char letra = palabra.charAt(k);
if (letra == 'a' || letra == 'e' || letra == 'i' || letra == 'o' || letra == 'u') {
contador[i][j]++;
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Input number of rows of matrix: ");
int rows = input.nextInt();
System.out.print("Input number of columns of matrix: ");
int columns = input.nextInt();
int[][] matrix = new int[rows][columns];
System.out.println("Input elements of matrix: ");
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
matrix[i][j] = input.nextInt();
}
}
int max = matrix[0][0];
int min = matrix[0][0];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
if (matrix[i][j] > max) {
max =
matriz = [1,2,3,4,5,6,7,8,9]
def multiplo(lista)
newmatriz = []
for i in range(len(lista)):
if(lista[i] % 2 == 0 and lista[i] % 3 == 0):
newmatriz.append(lista[i] * 5)
else:
newmatriz.append(lista[i])
return newmatriz
// matriz = [5,2,15,4,5,30,7,8,45]
String[][] matrix="hola mundo".split(" ");
CantidadVocales(matrix)
public static void CantidadVocales(String[][] matrix) {
int cantVocales = 0;
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
for (int k = 0; k < matrix[i][j].length(); k++) {
if (matrix[i][j].charAt(k) != ' ') {
char c = matrix[i][j].charAt(k);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') {
cantVocales++;
}
}
}
System.out.print(cantVocales + " "
Script
// First element of the array
var matrix = [
[1,2,3],
[4,5,6],
[7,8,9]
];
//Show matrix
console.log(`${matrix[0]}\n${matrix[1]}\n${matrix[2]}`);
//Get the maximum value
let max = matrix[0][0]
//Get the minimum value
let min = matrix[0][0]
// Maximum value position
let maxPos = [];
//Minimum value position
let minPos = [];
//Check values
for (let i = 0; i < matrix.length; i++) {
for (let j = 0; j < matrix.length; j++) {
//set maximum value
if (matrix[i][j] > max) {
max = matrix[i][j]
maxPos = [i, j]
}
//set minimum value
if (matrix[i][j] < min) {
min = matrix[i][j]
Script
var countVowels = function(words) {
var vowels = ['a','e','i','o','u'];
var r = [];
for (var i = 0; i < words.length; i++) {
var word = words[i];
var countVowels = 0;
for (var j = 0; j < word.length; j++) {
var letter = word[j];
if (vowels.indexOf(letter) !== -1) {
countVowels++;
}
}
r.push(countVowels);
}
return r;
}
countVowels(["abecedario", "segundo", "tercero"])
def count_vowels(words):
vowels = ['a','e','i','o','u']
return [len([char for char in word if char in vowels]) for word in words]
import java.util.Scanner;
public class EjemploMatrices {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int f, c;
boolean flag = false;
int min = 0, max = 0;
int minf = 0, minc = 0;
int maxf = 0, maxc = 0;
System.out.print("Ingrese cantidad de filas: ");
f = sc.nextInt();
System.out.print("Ingrese cantidad de columnas: ");
c = sc.nextInt();
int matriz[][] = new int[f][c];
for (int i = 0; i < f; i++) {
for (int j = 0; j < c; j++) {
System.out.print("Ingrese elemento [" + i + "," + j + "]: ");
matriz[i][j] = sc.nextInt();
if (!flag) {
import java.util.Random;
public class Arrays {
public static int[][] contarVocales(String[][] palabras){
int[][] contadorVocales = new int[palabras.length][palabras[0].length];
for (int i = 0; i < palabras.length; i++) {
for (int j = 0; j < palabras[0].length; j++) {
int contador = 0;
String palabra = palabras[i][j];
for (int k = 0; k < palabra.length(); k++) {
char caracter = palabra.charAt(k);
if (caracter == 'a' || caracter == 'e' || caracter == 'i'
|| caracter == 'o' || caracter == 'u') {
contador++;
}
}
contadorVocales[i][j] = contador;
}
}
public int[][] multiplicarPor5(int[][] matriz){
int[][] matrizResultado = new int[matriz.length][matriz[0].length];
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[i].length; j++) {
if(i%3 == 0 && j%2 == 0){
matrizResultado[i][j] = matriz[i][j]*5;
} else {
matrizResultado[i][j] = matriz[i][j];
}
}
}
return matrizResultado;
}
public class Matriz {
public static void main(String args[]){
int filas, columnas;
int matriz[][];
double suma;
filas = Integer.parseInt(args[0]);
columnas = Integer.parseInt(args[1]);
matriz = new int[filas][columnas];
// Rellenar matriz
for(int i = 0; i < filas; i++){
for(int j = 0; j < columnas; j++){
System.out.print("Introduzca el valor de " + i + "," + j + ": ");
matriz[i][j] = Integer.parseInt(System.console().readLine());
}
}
suma = 0;
for(int i = 0; i < filas; i++){
for(int j = 0; j < columnas; j++){
suma += matriz[i][j];
}
System.out.println("La suma
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
int numRows = userInput.nextInt();
int numCols = userInput.nextInt();
int[][] arr = new int[numRows][numCols];
int max = 0;
int min = 0;
int maxRow = 0;
int maxCol = 0;
int minRow = 0;
int minCol = 0;
for (int i = 0; i < numRows; i++) {
for (int j = 0; j < numCols; j++) {
arr[i][j] = userInput.nextInt();
if (arr[i][j] > max) {
max = arr[i][j];
maxRow = i;
maxCol = j;
}
if (arr[i][j] < min) {
min = arr[i][j];
import java.util.Scanner;
public class Matriz{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int filas;
int columnas;
System.out.println("Introduce el numero de filas: ");
filas = scan.nextInt();
System.out.println("Introduce el numero de columnas: ");
columnas = scan.nextInt();
int matriz[][] = new int[filas][columnas];
int vectorFila[] = new int[filas];
int vectorColumna[] = new int[columnas];
for(int i=0; i<filas; i++){
for(int j=0; j<columnas; j++){
System.out.println("Introduce el valor de la matriz en ["+i+"]["+j+"]: ");
matriz[i][j] = scan.nextInt();
}
public static int[] contarVocales(String[] palabras) {
int[] vocales = new int[palabras.length];
for(int i = 0; i < palabras.length; i++){
int contador = 0;
for(int j = 0; j < palabras[i].length(); j++){
char letra = palabras[i].charAt(j);
if(letra == 'a' || letra == 'e' || letra == 'i' || letra == 'o' || letra == 'u'){
contador++;
}
}
vocales[i] = contador;
}
return vocales;
}