lunes, 28 de julio de 2025

Repaso Laboratorio 2

 Ejemplo 1

// Online Java Compiler

// Use this editor to write, compile and run your Java code online

import java.util.Scanner;

class Main {

    public static void main(String[] args) {

        Scanner ingreso= new Scanner(System.in);

        System.out.println("Ingrese valor 1");

        int valor1 = ingreso.nextInt();

        System.out.println("Ingrese valor 2");

        int valor2 = ingreso.nextInt();

        if (valor1>valor2){

            System.out.printl("Valor 1 es el mayor");

        }

        else{

            System.out.printl("Valor 2 es el mayor");

        }

    }

}

No hay comentarios:

Publicar un comentario

Pie de página