Ejercicios De Algoritmo

Páginas: 2 (368 palabras) Publicado: 10 de agosto de 2012
 EJERCICIO 1:Promedio
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/package IZQUIERDO;
importjava.util.Scanner;
public class Main {
/*** @paramargs the command line arguments
*/public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int n1;
int n2;
int n3;
int promedio=0;System.out.println("ingerese el numero1:" );
n1=entrada.nextInt();
System.out.println("ingerese el numero2:" );
n2=entrada.nextInt();
System.out.println("ingerese el numero3:" );n3=entrada.nextInt();
promedio=(n1+n2+n3)/3;
if (promedio>10.5){
System.out.printf("aprobado:" );
}
else{
System.out.printf("desaprobado:" );
}
}
 EJERCICIO 2: COMPARACION MAYOR,MENOR
/** To change this template, choose Tools | Templates
* and open the template in the editor.
*/packageAplication;
importjava.util.Scanner;
public class Main {
/*** @paramargs thecommand line arguments*/
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int n1;
int n2;
int n3;
int mayor=0;
System.out.println("ingresenumero 1:");
n1 = entrada.nextInt();
System.out.println("ingresenumero 2: ");
n2 = entrada.nextInt();
System.out.println("ingresenumero 3: ");
n3 = entrada.nextInt();
if (n1>n2){if (n1>n3){
mayor = n1;
}
else if (n2>n3){
mayor = n2;
}
else {
mayor = n3;
}
}
System.out.printf("El mayor es:" + mayor);
}
}
 EJERCICIO3:suma,resta,multiplicación,división.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/package javaapplication7;
/**** @author */
public class JavaApplication7 {
/***@paramargs the command line arguments*/
public static void main(String[] args) {
nt suma,resta,multiplicacion,Division,n1,n2,n3,n4;
n1=14;
n2=20;
n3=15;
n4=2;
suma=n1+n2;
resta=n1-n2;...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Ejercicios de algoritmos
  • ejercicios algoritmo
  • Ejercicios
  • Ejercicios De Algoritmo
  • Ejercicios De Algoritmo
  • ejercicios de algoritmos
  • ejercicios de algoritmos
  • Ejercicios Algoritmos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS