|
|
back to boardDiscussion of Problem 1068. SumWhat's wrong with it???? #include<iostream> using namespace std; int main() {int n,s,i,S; cin>>n; if(n>0&&n<10000){ s=(n*(n-1)/2); cout<<s;} if(n<0&&n>-10000){ s=-(n*(n-1)/2)+1; cout<<s;} system("pause"); return 0;
} |
|
|