|
|
back to boardDiscussion of Problem 1068. Sumcompilation trouble Posted by Woz3qK 15 Jan 2007 20:53 there are no errors. why? #include <iostream.h> int main() { int i,j; cin >> i; j= abs(i)*(abs(i)+1)/2; if (i>=1) cout << j; else cout << (-j+1); } Re: compilation trouble #include <iostream> // <-- Problem was here using namespace std; // change it in your solution int main() { int i,j; cin >> i; j= abs(i)*(abs(i)+1)/2; if (i>=1) cout << j; else cout << (-j+1); } |
|
|