Está en la página 1de 6

Ejercicio 1

Inicio
Entero: cantidades[]
i = 0; i < 20; i++
Escribir "Vec[" + i + "]: "
Leer cantidades[i]
numPar()
numImp()
Fin

numPar()
i = 0; i < 20; i++

notas[i] % 2 == 0

V F
Escribir "Numero par: " + notas[i]

numImp()
i = 0; i < 20; i++

notas[i] % 2 ¡= 0

V F
Escribir "Numero imparpar: " +
notas[i]

Ejercicio 7

Inicio
Entero: tmaxi[],tmini[]
i = 0; i < 10; i++
Escribir "Ingresar temperatura min: "
Escribir "Vec[" + i + "]: "
Leer tmini[i]
Escribir "Ingresar temperatura max: "
Escribir "Vec[" + i + "]: "
Leer tmaxi[i]
calcProm()
Fin

calcProm()
Entero: promediovar
i = 0; i < 10; i++
promediovar = (tmin[i] + tmax[i]) / 2
Escribir "temperatura" + i + "min es: " + tmin[i] + " y la maxima: " + tmax[i]
Escribir "El promedio " + i + " es: " + promediovar

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

/*

* 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 Bustamante

*/

public class ejercicio1Main {

public static void main(String[] args) throws IOException {

int cantidades[] = new int[20];

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

for (int i = 0; i < 20; i++) {

System.out.print("Vec[" + i + "]: ");

cantidades[i] = Integer.parseInt(br.readLine());

ejercicio1 matema = new ejercicio1();


matema.setNotas(cantidades);

matema.numPar();

matema.numImp();

public class ejercicio1 {

private int notas[];

public void setNotas(int[] notas) {

this.notas = notas;

public int[] getNotas() {

return notas;

public void numPar() {

for (int i = 0; i < notas.length; i++) {

if (notas[i] % 2 == 0) {

System.out.println("Numero par: " + notas[i]);

}
public void numImp() {

for (int i = 0; i < notas.length; i++) {

if (notas[i] % 2 != 0) {

System.out.println("Numero impar: " + notas[i]);

package ejer7;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

/**

* @author Bustamante

*/

public class ejercicio7Main {

public static void main(String[] args) throws IOException {

int tmaxi[] = new int[10];

int tmini[] = new int[10];

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


for (int i = 0; i < 10; i++) {

System.out.println("Ingresar temperatura min: ");

System.out.print("Vec[" + i + "]: ");

tmini[i] = Integer.parseInt(br.readLine());

System.out.println("Ingresar temperatura max: ");

System.out.print("Vec[" + i + "]: ");

tmaxi[i] = Integer.parseInt(br.readLine());

ejercicio7 matema = new ejercicio7();

matema.setMin(tmini);

matema.setMax(tmaxi);

matema.calcProm();

package ejer7;

/**

* @author Bustamante

*/

public class ejercicio7 {

private int tmin[], tmax[];

public void setMin(int[] tmin) {

this.tmin = tmin;
}

public void setMax(int[] tmax) {

this.tmax = tmax;

public int[] getMin() {

return tmin;

public int[] getMax() {

return tmax;

public void calcProm() {

int promediovar;

for (int i = 0; i < 10; i++) {

promediovar = (tmin[i] + tmax[i]) / 2;

System.out.println("temperatura" + i + "min es: " + tmin[i] + " y la maxima: " + tmax[i]);

System.out.println("El promedio " + i + " es: " + promediovar);

También podría gustarte