Ask coding questions

← Back to all posts
how can I tell the compiler a number is odd or even ?
Donbit (1)

Write a conditional statement that evaluates whether the value for a number property is odd or even. If the number is even, print "The number is even", otherwise, print "The number is odd".

Commentshotnewtop
ronniegertman (4)

in many langueges use the following steps:
for example java:
int num;
if (num%2==0)
System.out.println("even");
else
System.out.println("odd");