-
Which of the following is good coding practice to determine oddity?
i)public boolean Calc(int n)
{
return (n & 1)!= 0;
}
ii)public boolen Calc(int n)
{
return n % 2 == 1;
}
-
- i
- ii
- option (i) causes compilation error
- option (ii) causes compilation error
- None of these
Correct Option: A
Arithmetic and logical operations are much faster than division and multiplication.