i need help...

im new to this forum and quite new to pascal..
i have soon an exam, but i still cant figure some parts out..
i hope someone can explain it simply to me the following code..

the program should do the next..take out all EVEN numbers in the array(without a helping array)..

procedure EVENOUT(n:integer; var m:integer; var a:array);
var i:integer;
if odd(n)
then m:=n div 2+1
else m:=n div 2;
for i:=2 to m do
a[i] := a[2*i-1]

hope someone can explain it to me, the whole odd and div thing :)


  • I'll explain some of what goes on in this procedure.
    Odd is a boolean function in Pascal that determines
    whether an integer is either [b]odd[/b](TRUE) or
    [b]even[/b](FALSE). Div is the [b]integer[/b] form of division
    whereas / is the [b]real[/b] form.
    Now, what the rest of the procedure does is a head
    scratcher. Why not take a few numbers and try them
    out to see what happens.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion