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

whats wrong? test # 9
Posted by No one knows me 6 Nov 2014 13:21
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
    long int range, total = 0;
    cin >> range;
    if ( range <= 0 && abs(range) < 10000 )
    {
        for ( int x = 1; x >= range; --x )
            total += x;
        cout << total << endl;
    }
    else if ( range > 0 && abs(range) < 10000 )
    {
        for ( int x = 1; x <= range; ++x )
            total += x;
        cout << total << endl;
    }



    return 0;
}
Re: whats wrong? test # 9
Posted by Pooria 22 Nov 2014 20:19


Edited by author 22.11.2014 20:22