|
|
back to boardDiscussion of Problem 1068. SumВ чем проблема?( Posted by DeDaRm 10 Nov 2013 23:03 #include <iostream> using namespace std; int main () { int x,y=0; cin >> x; if (x==1) { cout << x-1; return 0; system ("pause > void"); } if (x>1 && x<=10000) { for (int z=1;z<=x;++z) { y+=z; } } if (x<1 && x>=-10000) { for (int z=x;z<=1;++z) { y+=z; } } cout << y; system ("pause > void"); } Edited by author 10.11.2013 23:05 Re: В чем проблема?( For x=1 your output is wrong; why do you print x-1? Re: В чем проблема?( Posted by DeDaRm 15 Nov 2013 18:47 ok,THX)) if x=1,cout x or 1 Edited by author 15.11.2013 18:51 |
|
|