57.8k views
5 votes
Write an expression that evaluates to true if the integer variable x contains an even value, and false if it contains an odd value

User Jenorish
by
5.5k points

1 Answer

1 vote

Answer:

Step-by-step explanation:

I don't know what language you use, but mod is a common command in almost all of them. You could write it like this

for x = 1 to 10 do begin

if x mod 2 = 0 then print x " is even."

id x mod 2 = 1 then print x " is odd."

end;

User Dodol
by
6.4k points