I think I found that same answer. here is what I wrote
Code:FUNCTION AVSQRSUM(A,B,C,D:integer):integer; begin AVSQRSUM := ((A*A) + (B*B) + (C*C) + (D*D) DIV 4); end;
program test;
var
a, b, c, d, result : integer;
begin
a := 2;
b := 2;
c := 2;
d := 2;
result := (((a*a)+(b*b)+(c*c)+(d*d)) DIV 4);
writeln(result);
end.
DIV applies to integers
/ applies to real (float) numbers
When I wrote it like this the RESULT was 4
program test;
var
a, b, c, d, result, min, max : integer;
begin
a := 12;
b := 18;
c := 18;
d := 18;
min := 10;
max := 20;
if (((a) OR (b) OR (c) OR (d)) > max)
then writeln ('not in range ');
else writeln ('INRANGE');
end.
Is the IF statement legal bellow?
PROGRAM
CONST
MYRANGEMIN = 10;
MYRANGMAX = 20;
PROGRAM
VAR
CUBESUM, SQUARESUM, SQUARECOUNT : INTEGER;
if ((a > max) or (b > max) or (c > max) or (d > max))
then writeln ('not in range ')
else writeln ('INRANGE');
end.