Write a program to test whether a given number is divisible by another given number.
Answers
Answered by
12
import java.util.*;
class and
{
public static void main(String ar[])
{
Scanner sc= new Scanner (System.in);
System.out.println("number to check");
int a= sc.nextInt();
System.out.println("number to divide");
int b=sc.nextInt();
if(a%b==0)
System.out.print("divisible");
else
System.out.println("not divisible");
}}
Similar questions