|
|
back to boardDiscussion of Problem 1068. SumWhat is wrong here? Posted by Otaku 11 Mar 2009 10:38 #include<iostream> using namespace std; int main() { int b,c=0; cin>>b; for(int i=0;i<=b;i++){ c+=i;} if(b<0){ for(int a=0;a>=b;a--){ c+=a; }c=c+1;} cout<<c; return 0; } I WROTE OWN EXAMPLES AND IT PASSED ALL OF THEM!!! Edited by author 11.03.2009 10:39 Re: What is wrong here? Posted by melkiy 11 Mar 2009 11:29 Try 0 as input, and speak not so loud, please ;) |
|
|