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

What is wrong??? Pascal
Posted by mahone 12 Feb 2011 23:17
var
a:array[1..10000]of integer;
n,i,d,s:integer;
begin
read(n);
for i:=1 to n do
if abs(n)<10000 then
if n<=0 then d:=-1
else
d:=1;

S:=((2+(n-1)*d)*n div 2 ));

write(s);
end.



(12,26) Fatal: Syntax error, ";" expected but ")" found
Re: What is wrong??? Pascal
Posted by B-S42#-1Shipulin 13 Feb 2011 08:46
Your wrong in:
S:=((2+(n-1)*d)*n div 2 ));

I think right:
S:=((2+(n-1)*d)*n div 2);