|
|
back to boardDiscussion of Problem 1068. Sumproblem 1068 wrong answer?? Posted by sar 15 Feb 2015 21:02 #include<iostream> using namespace std; int main() { long int N,i,sum=0; cin >> N; if (N > 10000 || N < -10000) { cout<<sum; return 0; } if(N>0) for(i= N; i>= 1; i-- ) sum=sum+i; if(N<0) for(i= N; i<=1; i++) sum=sum+i; cout<<sum; } |
|
|