Computer Science, asked by TheVerifiedQuestion, 1 month ago

Java program to find even or odd​

Answers

Answered by prabhjotkaur7567
0

Explanation:

check whether no. is odd or even

Attachments:
Answered by BrainlyProgrammer
3

Answer:

import java.util.*;

class abc{

public static void main (String ar []){

Scanner sc=new Scanner(System.in);

System.out.println("Enter a number");

int a=sc.nextInt();

System.out println((a%2==0)?"Even":"Odd");

}

}

Logic:-

  • Accept a number
  • Check if it is even or odd
  • If even,print "Even"
  • else print "odd"
Similar questions