|
|
back to boardDiscussion of Problem 1068. SumIncorrect output ? It keeps saying that my program produces incorrect solutions. Anyone else is having the same issue? #include <stdlib.h> #include <stdio.h> int main() { int start, change, N, sum; scanf("%d", &N); if (abs(N) <= 10000) { change = N > 1 ? 1 : -1; for (start = 1; start != (N + change); start += change) sum += start; printf("%d\n", sum); } return 0; } |
|
|