Trying to make a multiplier (And a divider so don't take my idea).
SCAR Code:
Function MultiplyMultiplication(Prob1: Integer; Prob2: Integer):Integer;
Var P1,P2,I,Y,K :Integer;
begin
P1 := Prob1;
P2 := Prob2;
Y := 0;
K := 0;
Repeat
K := Y + P1;
I := I + 1;
Until(I = P2)
Writeln( IntToStr(K) )
Result := K;
end;
Compiles fine. But when i multiply 2*2 it comes out to be 2. Something may be wrong with the variables i suppose? I used For I:= 0 To P2 Do... And thought that was the problem. I talked to soon. Any ideas on how i should work this out?