input a number in java and check if it is divisible by 5 and 7 or 2 by the If Else process
Answers
Answered by
1
import java.util.Scanner
public class Number
{
void main()
{
Scanner sc=new.Scanner(System.in);
System.out.println("enter a number");
int a=sc.nextInt();
if (a%5==0)
System.out.println("divisible by 5");
else if (a%7==0)
System.out.println("divisible by 7");
else if (a%2==0)
System.out.println("divisible by 2");
}
}
Similar questions
Math,
7 months ago
Math,
1 year ago
Physics,
1 year ago
Math,
1 year ago
Computer Science,
1 year ago