|
|
back to boardDiscussion of Problem 1068. SumSolved There is a catch, you should account for three situations: 1) N > 0 2) N < 0 3) N == 0 <--- 8-D. Small assignment, but took an hour of trying. Re: Solved you could just come up with the relatively less error-prone solution in one line for(int i = 1; i!=N+2*(N>0)-1; i+=2*(N>0)-1) sum+=i; Edited by author 16.11.2013 15:47 |
|
|