answersLogoWhite

0


Best Answer

Implement this method:

public static boolean isDivisible(int a, int b) {

if(a % b == 0) {

return true;

}

else {

return false;

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java program to check A is divisible by B?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Java program to swap values of 2 variables?

a=a+b; b=a-b; a=a-b;


The name of a Java program file must match the name of the class with the extension java A True B False?

True


How are java program statements terminated?

Each statement in Java ends with a semicolon, for example: int a; a = 5; int b = 10;


Write a program to find gcd using recursive method in java?

for two positive integers: public static int gcd(int i1, int i2) { // using Euclid's algorithm int a=i1, b=i2, temp; while (b!=0) { temp=b; b=a%temp; a=temp; } return a; }


Write a java program of addition of two variables?

public class AddNumbers{ public int add(int a, int b){ return a + b; } }


What can you conclude if a and b are nonzero integers such that a divisible by b and b divisible by a?

That a = ±b


Program to swap two numbers using three variables in java?

temp = a; a = b; b = temp;temp = a; a = b; b = temp;temp = a; a = b; b = temp;temp = a; a = b; b = temp;


How do you write java program to times a number?

Java, like many other programming languages, uses the asterisk for the multiplication operator. Therefore, two numbers a and b are multiplied, and their product assigned to a variable r, with this construct: r = a * b;


What has the author William B Brogden written?

William B. Brogden has written: 'Java 2 exam cram' -- subject(s): Java (Computer program language), Study guides, Electronic data processing personnel, Examinations, Certification


Which is not a stand alone program a. Java b. Javascript c. Both a and b d. None of the above?

If you are talking about programs written in those languages: Both. Java relies on the JVM and Javascript relies on your web browser. Otherwise: Neither


Program in java to illustrate the pre increment and post increment?

An example might help:int a, b;a= 2;b= a++;/* now a=3, b=2 */a= 2;b= ++a;/* now a=3, b=3 */Read more: What_is_difference_between_pre_increment_and_post_increment


What are the factors of 312 using the divisibility rule?

312 is divisible by 2 b/c the 2 at the end of 312 is an even number312 is divisible by 3 b/c 3 + 1 + 2 = 6 which is divisible by 3312 is divisible by 4 b/c 12 is divisible by 4312 is not divisible by 5 b/c the one's place isn't 0 or 5312 is divisible by 6 b/c 312 is divisible by 2 and 3312 is not divisible by 7 b/c 2*7=14, 31-14=17 which is not divisible by 7312 is divisible by 8 b/c 312/8=39 (Explanation: A way to find out how 8 is divisible its that its first three digits [the ones, tens, and hundreds place] have to be divisible by 8)312 is not divisible by 9 b/c 3 + 1 + 2 = 6 which is not divisible by 9312 is not divisible by 10 b/c the ones place is not 0