2 write a Java Program to check whether the number is divided by 2
Answers
Answered by
1
- Write a java program to check whether a number is divisible by 2.
import java.util.*;
class Division
{
public static void main(String s[])
[
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number: ");
int n=sc.nextInt();
if(n%2==0)
System.out.println("Number is divisible by 2.");
else
System.out.println("Number is not divisible by 2.");
}
}
Similar questions
History,
3 months ago
Computer Science,
3 months ago
Computer Science,
3 months ago
Math,
7 months ago
Math,
11 months ago
Hindi,
11 months ago