fork download
  1. #include<stdio.h>
  2. int main(){
  3. int n,N,ans;
  4. scanf("%d",&N);
  5. if(N > 1){
  6. n=N;
  7. }else{
  8. n=-1*N+2;
  9. }
  10. ans=(n*(N+1))/2;
  11. printf("%d\n",ans);
  12. return 0;
  13.  
  14. }
  15.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
1