|
|
back to boardDiscussion of Problem 1068. SumHelp me find the bug #include <stdio.h> int main () { int m ,i, sum; scanf("%d", &m); if(m >= 0){ sum = (m*(m+1))/2 ; printf("%d\n", sum); } else{ for(i=1, sum =0; i>=m; i-- ){ sum = sum+i; } printf("%d\n", sum); } return 0; } Re: Help me find the bug input 0 output 1 |
|
|