Java

Logic to find whether number is Even or Odd

 

 
class EvenOdd 
{
 public static void main(String[] args) 
 {
  int n=7;

  if (n==0)
  {
   System.out.println("Number is 0");
  }
  else
  {
   if (n%2==0)
   {
    System.out.println("Number is Even");
   }
   else
   {
    System.out.println("Number is Odd");
   }
  }
 }
}
 

Related Posts

Table Of Contents

;