█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 6060

Problema 0x78 - Suma de 2 números

  • Autor: Justin
  • Fecha: 2022-05-20 20:09:02 UTC (Hace 8 meses)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:3: error: class, interface, or enum expected
  public static void main(String args[]){
                ^
Main.java:5: error: class, interface, or enum expected
    Scanner ent = new Scanner(System.in);
    ^
Main.java:7: error: class, interface, or enum expected
    System.out.print("Ingresa el primer valor: ");
    ^
Main.java:8: error: class, interface, or enum expected
    a = ent.nextInt();
    ^
Main.java:10: error: class, interface, or enum expected
    System.out.print("Ingresa el segundo valor: ");
    ^
Main.java:11: error: class, interface, or enum expected
    b = ent.nextInt();
    ^
Main.java:13: error: class, interface, or enum expected
    System.out.print(a + b);
    ^
Main.java:14: error: class, interface, or enum expected
  }
  ^
8 errors

                    
#2
Error de compilación
                      Main.java:3: error: class, interface, or enum expected
  public static void main(String args[]){
                ^
Main.java:5: error: class, interface, or enum expected
    Scanner ent = new Scanner(System.in);
    ^
Main.java:7: error: class, interface, or enum expected
    System.out.print("Ingresa el primer valor: ");
    ^
Main.java:8: error: class, interface, or enum expected
    a = ent.nextInt();
    ^
Main.java:10: error: class, interface, or enum expected
    System.out.print("Ingresa el segundo valor: ");
    ^
Main.java:11: error: class, interface, or enum expected
    b = ent.nextInt();
    ^
Main.java:13: error: class, interface, or enum expected
    System.out.print(a + b);
    ^
Main.java:14: error: class, interface, or enum expected
  }
  ^
8 errors

                    
#3
Error de compilación
                      Main.java:3: error: class, interface, or enum expected
  public static void main(String args[]){
                ^
Main.java:5: error: class, interface, or enum expected
    Scanner ent = new Scanner(System.in);
    ^
Main.java:7: error: class, interface, or enum expected
    System.out.print("Ingresa el primer valor: ");
    ^
Main.java:8: error: class, interface, or enum expected
    a = ent.nextInt();
    ^
Main.java:10: error: class, interface, or enum expected
    System.out.print("Ingresa el segundo valor: ");
    ^
Main.java:11: error: class, interface, or enum expected
    b = ent.nextInt();
    ^
Main.java:13: error: class, interface, or enum expected
    System.out.print(a + b);
    ^
Main.java:14: error: class, interface, or enum expected
  }
  ^
8 errors

                    
#4
Error de compilación
                      Main.java:3: error: class, interface, or enum expected
  public static void main(String args[]){
                ^
Main.java:5: error: class, interface, or enum expected
    Scanner ent = new Scanner(System.in);
    ^
Main.java:7: error: class, interface, or enum expected
    System.out.print("Ingresa el primer valor: ");
    ^
Main.java:8: error: class, interface, or enum expected
    a = ent.nextInt();
    ^
Main.java:10: error: class, interface, or enum expected
    System.out.print("Ingresa el segundo valor: ");
    ^
Main.java:11: error: class, interface, or enum expected
    b = ent.nextInt();
    ^
Main.java:13: error: class, interface, or enum expected
    System.out.print(a + b);
    ^
Main.java:14: error: class, interface, or enum expected
  }
  ^
8 errors

                    
#5
Error de compilación
                      Main.java:3: error: class, interface, or enum expected
  public static void main(String args[]){
                ^
Main.java:5: error: class, interface, or enum expected
    Scanner ent = new Scanner(System.in);
    ^
Main.java:7: error: class, interface, or enum expected
    System.out.print("Ingresa el primer valor: ");
    ^
Main.java:8: error: class, interface, or enum expected
    a = ent.nextInt();
    ^
Main.java:10: error: class, interface, or enum expected
    System.out.print("Ingresa el segundo valor: ");
    ^
Main.java:11: error: class, interface, or enum expected
    b = ent.nextInt();
    ^
Main.java:13: error: class, interface, or enum expected
    System.out.print(a + b);
    ^
Main.java:14: error: class, interface, or enum expected
  }
  ^
8 errors

                    
Puntos totales: 0 / 100

Código

import java.util.Scanner;

  public static void main(String args[]){
    int a, b;
    Scanner ent = new Scanner(System.in);

    System.out.print("Ingresa el primer valor: ");
    a = ent.nextInt();

    System.out.print("Ingresa el segundo valor: ");
    b = ent.nextInt();

    System.out.print(a + b);
  }
}