Computer Science, asked by ac1485, 1 year ago

Write a program in java to find out if the number is divisible by 2 or not???

Answers

Answered by QGP
0
Hey There,

Here's your code:
import java.util.Scanner;
public class Even_Odd
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int n = sc.nextInt();
       
       
        if(n%2==0)
            System.out.println(n+" is even.");
        else
            System.out.println(n+" is odd.");
    }
}


Hope it helps
Purva
Brainly Community




Similar questions