| 
 | 
вернуться в форумall is ok,but why getting wrong answer??C language #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; } Re: all is ok,but why getting wrong answer??C language Your code is almost okay.It's wrong only for one test case. When n=0 then according to your code output will be 0.But right answer is 1. Please check again output condition of this problem.  Otherwise  https://ideone.com/Q6C1gh |  
  | 
|