|
|
back to boardDiscussion of Problem 1068. SumWhat here not so? #include <iostream> #include <math.h> using namespace std; int main(int argc, char* argv[]) { int N,Sum=0; cout<<"Введите значение"<<endl; cin>>N; if(N>0 && N<=abs(1000)) { for(int i=0;i<=N;i++) { Sum+=i; } cout<<Sum; } if(N<0 && N<=abs(-1000)) { for(int j=0;j>=N;j--) { Sum+=j; } cout<<Sum; } getch(); return 0; } Edited by author 05.07.2013 20:36 Edited by author 05.07.2013 20:38 Re: What here not so? from the first glance: it's supposed to be 10000, not 1000 |
|
|