|
|
back to boardDiscussion of Problem 1068. Sumwhy not right& Posted by legik 6 May 2011 16:41 #include <iostream> using namespace std; int main() { int n; int sym=0; int znak; cin>>n;
n>0?znak=1:znak=-1; n=abs(n); for (int i=2;i<=n;i++) sym+=i; cout<<sym*znak; cin>>n; return 0; } Re: why not right& try by yourself input (output) 1 (1) 0 (1) -1 (0) -2 (-2) |
|
|