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 compilation error? but My compiler run this
Posted by Monir 13 Oct 2019 01:00
#include<stdio.h>
#include<math.h>

int main(){
int n;
scanf("%d",&n);

if(n==0){printf("%d",1);}
else if(n>0){printf("%d",(n*(n+1))/2);}
else{
        n=fabs(n);
        printf("%d",-1*(((n*(n+1))/2)-1));
    }

return 0;
}
Re: Why compilation error? but My compiler run this
Posted by XJS_XY 30 Nov 2019 13:49


Edited by author 30.11.2019 13:52