|
|
back to boardDiscussion of Problem 1068. SumWhat 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 Your wrong in: S:=((2+(n-1)*d)*n div 2 )); I think right: S:=((2+(n-1)*d)*n div 2); |
|
|