|
|
вернуться в форумProblem 1068 mystery I don't know why I always get "wrong answer" for submitting my pascal program, solving this problem. I'd be pleased if someone will give me code, that solves it (I'm just curious what is wrong in my program). Re: Problem 1068 mystery Послано GoGo 3 сен 2001 01:56 > I don't know why I always get "wrong answer" for submitting > my pascal program, solving this problem. I'd be pleased if > someone will give me code, that solves it (I'm just curious > what is wrong in my program). Here is my source : (C++) #include <stdio.h> int i;long sum=0; int n; void main() { scanf("%d",&n); if(n<1) for(i=1;i>=n;i--) sum+=i; else for(i=1;i<=n;i++) sum+=i; printf("%ld",sum); } |
|
|