ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1068. Sum

Programme 1068 o
Posted by Fadeev.E.V 30 Dec 2010 21:31
Greetings to all. I want to learn that such here with a problem number 1068, I all have correctly written that kompiliator from me demands, tell please.
Here the  *_Pascal_* language program:
___________________________________________
var s,i,n:integer;
BEGIN
s:=0;
read(n);
if (n>=0) then
for i:=1 to N do
s:=s+i;
if (n<=0) then
for i:=-1 downto N do
s:=s+i;
Writeln(s);
END.
___________________________________________
Re: Programme 1068 o
Posted by Fadeev.E.V 30 Dec 2010 23:46
please, help me.
Read statement carefully
Posted by vgu 31 Dec 2010 00:49
You need calculate sum between 1 and N. So, if n<=0, you should sum 1,0,-1,-2,...N. But not -1,-2,...-N.
Re: Read statement carefully
Posted by Fadeev.E.V 31 Dec 2010 03:36
Thank you.