Computer Science, asked by pragyapathak12, 1 year ago

write a java program to check whether the no. is even or odd

Answers

Answered by garywalter1221
6

import java.util.Scanner;

class CheckEvenOdd

{

 public static void main(String args[])

 {

   int num;

   System.out.println("Enter an Integer number:");

 

   Scanner input = new Scanner(System.in);

   num = input.nextInt();

 

   if ( num % 2 == 0 )

       System.out.println("Entered number is even");

    else

       System.out.println("Entered number is odd");

 }

}


pragyapathak12: thx
garywalter1221: u r welcome
Answered by mathipriyasandeep
2

class san

{

void main(int n)

{

if (n%2==0)

System.out.println("Even number");

else

System.out.println("Odd number")

}

}


Similar questions