|
|
back to boardDiscussion of Problem 1068. SumWhy? Wrong answer test#9 #include<iostream> using namespace std; int main() { short int s,i,n; 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;
} |
|
|