|
|
вернуться в форумPorque error? import java.util.Scanner; public class Main { public void solucion(int num) { int aux = 0; if (num <0) { for (int i = num; i <= 1; i++) { aux += i; } } else { for (int j = num; j >= 1; j--) { aux += j; } } System.out.println(aux); } public static void main(String[] args) { Main obj = new Main(); Scanner leer = new Scanner(System.in); int numero = leer.nextInt(); if (numero < 10000) { obj.solucion(numero); } } } |
|
|