View Full Version : Even or odd
cathering_
07-22-2007, 11:05 PM
Any function that returns ture or false if a integer is even or odd? XD
bullzeye95
07-22-2007, 11:38 PM
function IsEven(I: Integer): Boolean;
begin
Result:= ((I mod 2) = 0);
end;
function IsOdd(I: Integer): Boolean;
begin
Result:= (not(IsEven(I)));
end;
:)
LordGregGreg
07-22-2007, 11:41 PM
Any function that returns ture or false if a integer is even or odd? XD
Sure, illl make u one.
PROGRAM New;
FUNCTION isEven(greg: INTEGER): BOOLEAN;
BEGIN
IF ((greg MOD 2) = 0) THEN
Result := True;
//result:=false; not really needed...
END;
BEGIN
IF (isEven(2)) THEN
BEGIN
writeln('it is even!');
END
ELSE
BEGIN
writeln('it is odd');
END;
END.
bullzeye95
07-22-2007, 11:45 PM
Beat you! Hahahaha!
Oh and cathering, mine's better.
LordGregGreg
07-22-2007, 11:47 PM
Beat you! Hahahaha!
Oh and cathering, mine's better.
BLAST!
well, mine looks better. and.. yeah.
hey, have u seen the new sigs?
EDIT: yeah, his is better.
bullzeye95
07-22-2007, 11:50 PM
Nope, I haven't. Difference besides look? Should I give myself noob points for this post?
LordGregGreg
07-22-2007, 11:54 PM
Nope, I haven't. Difference besides look? Should I give myself noob points for this post?None, other then it comes in 4 yummy colors...
and it shows 5 ppl instead of 3.
redirect all comments to http://www.villavu.com/forum/showthread.php?t=13889
cathering_
07-22-2007, 11:55 PM
Lol thanks :P
mod means if it divs with no remainders? XD
rotflmfwao
07-23-2007, 01:34 AM
Lol thanks :P
mod means if it divs with no remainders? XD
So right. +rep for you for knowing that.
Pancakes
07-23-2007, 02:28 AM
You could just try to divide it by two.. if it returns a whole number, its even.
Edit: I should really read before I post... lol
bullzeye95
07-23-2007, 02:33 AM
Lol thanks :P
mod means if it divs with no remainders? XD
No, actually. It returns the remainder.
SKy Scripter
07-23-2007, 03:12 AM
i should be at the top of the noob list i have 100 noob points....!!!!
oh well....
cathering_
07-23-2007, 12:14 PM
No, actually. It returns the remainder. oh now i no why your putting the "= 0" :P
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.