Computer Science, asked by minakshi9494, 4 months ago

HELP

Guys please answer Q no. 3

Don't spam

Plzz answer guys

❣️​❣️​❣️​​

Attachments:

Answers

Answered by randomkingmail
1

Answer:

// write inside main function

Scanner s=new Scanner (System.in);

int i=s.nextInt();

if(i%2==0){

System.out.println("even");

else{

System.out.println("Odd");}

Answered by Anonymous
2

QUESTION

Write a java program , that takes a input number from user and find out whether that number is even or odd .

ANSWER

import java.util.Scanner;

public class EvenOdd {

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");

else

System.out.println(num + " is odd");

}

}

Output

Enter a number: 12

12 is even

THANKS..

Similar questions