Computer Science, asked by akashravi971, 7 months ago

2 write a Java Program to check whether the number is divided by 2​

Answers

Answered by anindyaadhikari13
1

\star\:\:\:\sf\large\underline\blue{Question:-}

  • Write a java program to check whether a number is divisible by 2.

\star\:\:\:\sf\large\underline\blue{Source\:Code:-}

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