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

all is ok,but why getting wrong answer??C language
Posted by Chowdhury Md. Ishmam Rahman 7 Oct 2017 11:23
#include<stdio.h>
#include<math.h>
int main()
{
    int i,sum=0,n;
    scanf("%d",&n);

    if(abs(n)<=10000){

    if(n<0){

    for(i=1;i>=n;i--){
        sum+=i;
    }
    }

    else{
        sum=((n*n)+n)/2;
    }

    printf("%d",sum);}
    return 0;
}