Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
program ArithmeticTest;
uses sysutils;
var
i, score, _random: integer;
FirstN, SecondN, answer, input: integer;
procedure Generate();
begin
randomize;
FirstN := Random(10);
SecondN := Random(10);
end;
begin
score:=0;
writeln('For division questions answer how many times the number divides fully');
for i:=0 to 9 do
begin
_random:=Random(4);
if _random = 0 then
begin
Generate();
Answer := FirstN+SecondN;
writeln(inttostr(FirstN)+' + '+inttostr(SecondN));
end
else if _random = 1 then
begin
Generate();
Answer := FirstN-SecondN;
writeln(inttostr(FirstN)+' - '+inttostr(SecondN));
end
else if _random = 2 then
begin
Generate();
Answer := FirstN*SecondN;
writeln(inttostr(FirstN)+' x '+inttostr(SecondN));
end
else if _random = 3 then
begin
Generate();
Answer := FirstN mod SecondN;
writeln(inttostr(FirstN)+' / '+inttostr(SecondN));
end;
readln(Input);
if (Input = Answer) then
begin
writeln('Correct');
score+=1;
end
else
writeln('Incorrect');
end;
writeln('Score: '+inttostr(score)+'/10');
readln;
end.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more