Answers for "find odd or even number in java without using mod operator"

0

even number without mod

function testodd(num) {
  if((num & 1) == 0){
    return true
  }
  return false;
}

var output = testodd(17);
console.log(output); // --> false
var output = testodd(-16); 
console.log(output); // --> true
var output = testodd(0); 
console.log(output); // --> true
Posted by: Guest on November-08-2020
0

Odd or even program in java using a mod operator

import java.util.Scanner;public class Main{public static void main(String[] args){Scanner reader = new Scanner(System.in);System.out.print("Enter a number: ");int num = reader.nextInt();if(num % 2 == 0)System.out.println(num + " is even");elseSystem.out.println(num + " is odd");}}
Posted by: Guest on June-12-2021

Code answers related to "find odd or even number in java without using mod operator"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language