ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1068. Sum

Porque error?
Posted by nicoloco785 27 Feb 2011 21:50
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);
        }


    }
}