|  | 
|  | 
| back to board | Discussion of Problem 1068. SumWhy 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
 | 
 | 
|