Write a program in java to find out if the number is divisible by 2 or not???
Answers
Answered by
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
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