Answer the question
In order to leave comments, you need to log in
How can I make this simple code work?
I need all the variables listed to remain integers and fractional ones to remain fractional.
I understand that Pascal swears that the Integer variable is assigned an expression in which there are Real variables?
Question: How can I just write this expression into an Integer variable? Or is it impossible without changing anything in the variables?
Error: Incompatible types: 'integer' and 'Extended'
var
M,N,M1,M2,M3,x:integer;
N1,N2,N3:real;
for M1:=0 to trunc(N/MAX) do
begin
M2:=(N-M1*N1-M*N3+M1*N3);
if ((M2 mod 9 = 0) and (M2>=0)) then
begin
M3:=M-M1-(M2 div 9);
if(M3>=0) then
begin
...........
end;
end;
Answer the question
In order to leave comments, you need to log in
You'll have to think more. Solution found, thanks for such extensive help. A piece of code is from an Olympiad problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question