| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function Odd (i: Integer): Boolean; |
`Odd' checks the parity of its argument `i'. It returns `True' if the argument is odd, `False' if it is even.
`Odd' is defined in ISO-7185 Pascal and supported by all known Pascal variants.
program OddDemo;
var
Foo: Integer;
begin
Write ('Please enter an odd number: ');
ReadLn (Foo);
if not Odd (Foo) then
WriteLn ('Odd''s not even! Something''s odd out there ...')
else
WriteLn (Foo, ' is pretty odd.')
end.
|