Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Ejercicio #1 LOGICA.

FUNCIONES BASICAS

Nombres: Alessandro Pealoza, Juan Ruiz

Porcentaje terminado:100%

Comentarios:no tuvimos ningun problema al resolver las logicas

Codigos de Programa:
public static void main(String[] args) {
System.out.println(menorAux( 10, 25, 35, 40));
}
public static int menorAux(int a, int b, int c){
int men = a;
if (b < men) men = b;
if (c < men) men = c;
return men;
}

public static int menorAux(int a, int b, int c, int d){


int men = a;
if (b < men) men = b;
if (c < men) men = c;
if (d < men) men = d;
return men;}

public static int menorAux(int a, int b, int c, int d, int e){


int men = a;
if (b < men) men = b;
if (c < men) men = c;
if (d < men) men = d;
if (e < men) men = e;
return men;
}

public static void main(String[] args) {


System.out.println(mayorAux(14, 26, 32, 41, 52));
}
public static int mayorAux (int a, int b, int c){
int my = a;
if (b > my) my = b;
if (c > my) my = c;
return my;

public static int mayorAux (int a, int b, int c, int d){


int my = a;
if (b > my) my = b;
if (c > my) my = c;
if (d > my) my = d;
return my; }

public static int mayorAux (int a, int b, int c, int d, int e){
int my = a;
if (b > my) my = b;
if (c > my) my = c;
if (d > my) my = d;
if (e > my) my = e;
return my; }

public static void main(String[] args) {


System.out.println(menorAnd(12, 25, 56, 59, 62));
}
public static int menorAnd (int a, int b, int c){

if (a < b && a < c) return a;


if (b < a && b < c) return b;
else return c;
}

public static int menorAnd (int a, int b, int c, int d){

if (a < b && a < c && a < d) return a;


if (b < a && b < c && b < d) return b;
if (c < a && c < b && c < d) return c;

else return d;
}

public static int menorAnd (int a, int b, int c, int d, int e){

if (a < b && a < c && a < d && a < e) return a;


if (b < a && b < c && b < d && b < e) return b;
if (c < a && c < b && c < d && c < e) return c;
if (d < a && d < b && d < c && d < e) return d;

else return e;

public static int mayorAnd (int a, int b, int c){

if (a > b && a > c) return a;


if (b > a && b > c) return b;
else return c;
}

public static int mayorAnd (int a, int b, int c, int d){

if (a > b && a > c && a > d) return a;


if (b > a && b > c && b > d) return b;
if (c > a && c > b && c > d) return c;

else return d;
}

public static int mayorAnd (int a, int b, int c, int d, int e){

if (a > b && a > c && a > d && a > e) return a;


if (b > a && b > c && b > d && b > e) return b;
if (c > a && c > b && c > d && c > e) return c;
if (d > a && d > b && d > c && d > e) return d;

else return e;

public static void main(String[] args) {


// TODO code application logic here
System.out.println(mayor( 10, 25, 30, 50,8));
}
public static int menor ( int a, int b)
{
if (a < b) return a; else return b;
}
public static int menor (int a, int b, int c){
return menor(menor(a, b), c);
}
public static int menor (int a, int b, int c, int d){
return menor(menor(a, b, c), d);
}
public static int menor (int a, int b, int c, int d, int e){
return menor( menor( a, b ,c ,d),e);
}
public static int mayor ( int a, int b)
{
if (a > b) return a; else return b;
}
public static int mayor (int a, int b, int c){
return mayor(mayor(a, b), c);
}
public static int mayor (int a, int b, int c, int d){
return mayor(mayor(a, b, c), d);
}
public static int mayor (int a, int b, int c, int d, int e){
return mayor( mayor( a, b ,c ,d),e);
}

You might also like