|
|
back to boardDiscussion of Problem 1068. SumWhy wrong answer ? #include <stdio.h> void main() { int N,i,sum; sum = 0; scanf_s("%d", &N); if (N < 0) { for (i = N; i < 2; i++) { sum = sum + i; } } else { for (i = N; i > 0; i--) { sum = sum + i; } } printf("%d", sum);
} |
|
|