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

Why wrong answer?
Posted by Hasin Jannat 19 Jun 2018 13:52
#include<stdio.h>
#include<math.h>
int main()
{
    int N,i,sum;
    scanf("%d",&N);
    if(abs(N)<= 10000){
    if(N > 0){
      sum = (N * (N + 1))/2;
    }
     else if(N < 0)
    {
      sum = ((abs(N)+2) * (N + 1))/2;
    }
    printf("%d",sum);
    }
    return 0;
}

Edited by author 19.06.2018 15:45

Edited by author 19.06.2018 15:45