|
|
back to boardDiscussion of Problem 1068. Sum1068 where is wrong? ---------------------------------------- ----------------------------------------- #include<stdio.h> #include<stdlib.h> int main() { int number; int i; int sum; while(scanf("%d",&number)!=EOF){ if (number>=0) sum=(number*(number+1))/2; else if(number<0) sum=(number*(1-number))/2+1; printf("%d\n",sum); } return 0; } Edited by author 02.11.2007 21:42 |
|
|