Write a Program to check number is Even or Odd without using modulus(%) and division(/) operators

public class CheckEvenOdd{
     public static void main(String []args){
         int number = 10;
         int temp = 0;
         while (number > temp)
         {
             temp = temp + 2;
         }
         if(number == temp)
         System.out.println(number + " is Even");
         else
         System.out.println(number + " is Odd");
     }
}

Output: –

10 is Even

Leave a Reply

Your email address will not be published. Required fields are marked *