|
|
back to boardDiscussion of Problem 1068. Sumwhy wrong answer on test case #2 ? #include<stdio.h> int main() { int n, sum=0, i; scanf("%d", &n); if(n>0) { for(i=1; i<=n; i++) sum=sum+i; } else if(n<0) { for(i=n; i<=1; i++) sum=sum+i; } printf("%d", sum); return 0; } Re: why wrong answer on test case #2 ? Posted by decay 9 Nov 2018 15:02 What if N = 0? Re: why wrong answer on test case #2 ? thank you sir. |
|
|