MAYOR DE TRES NUMEROS
//mayor de tres numeros
import java.util.Scanner;
public class mayor {
public static void main(String[]arg){
Scanner m=new Scanner(System.in);
System.out.print("Dame un numero: ");
int a=m.nextInt();
System.out.print("Dame un segundo numero: ");
int b=m.nextInt();
System.out.print("Dame un tercer numero: ");
int c=m.nextInt();
int mayor;
if (a>=b && a>=c){
mayor=a;
System.out.println("El mayor: "+mayor);}
if (b>=a && b>=c){
mayor=b;
System.out.println("El mayor es: "+mayor);}
if (c>=a && c>=b){
mayor=c;
System.out.println("El mayor es : "+mayor);}
}
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario