Answer the question
In order to leave comments, you need to log in
Problem with "Else" conditional statement, can anyone help?
I saw that there are a lot of similar questions, but still I'll ask it again (Next is my program, the place of the problem is marked with a comment):
Var Mass:array [1..10] of real; i,k:integer; a,b:real;
Begin
Readln(Mass[1],Mass[2],Mass[3],Mass[4],Mass[5],Mass[6],Mass[7],Mass[8],Mass[9],Mass[ ten]);
For i:=1 to 10 do
a:=a+Mass[i];
a:=a/10;
Repeat
Begin
inc(i);
If Mass[i]>Mass[i+1] then
b:=Mass[i]-a;
Mass[i]:=b;
Mass[i+1]:=Mass[i+1]+a;
inc(k);
end;
Else //This moment
Begin
b:=Mass[i+1]-a;
Mass[i+1]:=b;
Mass[i]:=Mass[i]+a;
inc(k);
end;
Until i<>10
Writeln(k);
end.
After filling the array, an error pops up stating that "Else was met, but an operator was expected"
If (by rule) you remove the semicolon before Else, then it already starts to swear at its absence
. By the way, this problem occurs not only with the Repeat loop, but and with the rest, if it is of course useful information.
I will be grateful for help
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question