|  | 
|  | 
| вернуться в форум | Why do I get Compilation Error ??? Послано ValBG  28 мар 2002 10:10 This is my program and it works PERFECTLY well on Pascal. Why doesit get this ERROR on the online compilator???
 
 Program valeria(input,output);
 Var N,M:0..9;
 A:array[1..9]of 0..9;
 D:array[0..36]of word;
 k,s,i:longint;
 ch:char;
 
 Procedure Count;
 begin
 s:=0;
 for i:=1 to M do S:=S+A[i];
 Inc(D[s])
 end;
 
 Begin
 K:=0;
 for i:=1 to 36 do D[i]:=0;
 readln(N);
 M:=N div 2;
 if N=0 then K:=0 else
 if (N=1)or(N=2) then K:=10 else
 if N=3 then K:=100 else
 begin
 for A[1]:=0 to 9 do
 for A[2]:=0 to 9 do if M=2 then Count else
 for A[3]:=0 to 9 do if M=3 then Count else
 for A[4]:=0 to 9 do Count;
 K:=0;
 for i:=0 to M*9 do K:=K+sqr(D[i]);
 if N mod 2<>0 then K:=K*10;
 end;
 writeln(K);
 End.
Re: Why do I get Compilation Error ??? >  This is my program and it works PERFECTLY well on Pascal. Whydoes
 > it get this ERROR on the online compilator???
 >
 >  Program valeria(input,output);
 >  Var N,M:0..9;
 >      A:array[1..9]of 0..9;
 >      D:array[0..36]of word;
 >      k,s,i:longint;
 >      ch:char;
 >
 >  Procedure Count;
 >    begin
 >      s:=0;
 >      for i:=1 to M do S:=S+A[i];
 >      Inc(D[s])
 >    end;
 >
 >  Begin
 >    K:=0;
 >    for i:=1 to 36 do D[i]:=0;
 >    readln(N);
 >    M:=N div 2;
 >    if N=0 then K:=0 else
 >      if (N=1)or(N=2) then K:=10 else
 >         if N=3 then K:=100 else
 >       begin
 >         for A[1]:=0 to 9 do
 >           for A[2]:=0 to 9 do if M=2 then Count else
 >             for A[3]:=0 to 9 do if M=3 then Count else
 
 
 I compiled your program on DevPascal and found error in this line
 Error: Illegal counter variable
 >               for A[4]:=0 to 9 do Count;
 
 
 
 >         K:=0;
 >         for i:=0 to M*9 do K:=K+sqr(D[i]);
 >         if N mod 2<>0 then K:=K*10;
 >       end;
 >    writeln(K);
 >  End.
 | 
 | 
|