answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

#include<string.h>

int main (void) {

char arry[100];

int i,count=0;

float a,b;

printf("Enter a 2 Number ");

scanf("%d %d",&a,&b);

if(a%b == 0){printf("its divisible");} else {printf("its not divisible"); }

getch();

return 1;

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

There are many ways to do it.

  • You could create a loop that subtracts the second from the first and stops when the first is no longer positive. If the first ever becomes zero, it's a multiple.
  • You could divide the first with the second, multiply back the quotient with the second and compare with the first. If they are equal, it's a multiple.
  • The easiest way is most likely the use of modulo operator to check the remainder after division. if(A%B == 0) printf("equal"); :)
This answer is:
User Avatar

User Avatar

Aleena Adnan

Lvl 2
3y ago

#include

int main()

{

int m, n;

printf("Enter the values for M and N\n");

scanf("%d %d", &m, &n);

if (m / n!=1)

printf("divisible\n");

else

printf("not divisible\n");

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program that accepts two numbers a and b and checks whether or not a is divisible by b?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you tell whether a number is divisible by 3?

If the sum of its' digits are divisible by 3 for all numbers greater than 9.


Is 3 divisible by 6008?

All numbers are divisible by all numbers... They may turn out like decimals and imaginary numbers, but they can be divided. Now, whether 3 can be evenly divided into 6008 is a different question. And that answer would be no.


What happens when you divide using prime numbers?

The answer depends on whether or not the divisor is divisible evenly by the prime.


How do you find prime numbers between 2 and 70?

You can check each individual number, whether it is a prime number. For numbers below 100, it is enough to check whether they are divisible by 2, by 3, by 5, and by 7. If a number is divisible by none of these, it is a prime number.


Why are numbers odd and even?

That's a more or less arbitrary name given to numbers, to distinguish whether they are divisible by 2 (even) or not (odd).


Check whether 3 consecative prime nos are divisible by6if yes give example?

Prime numbers are not divisible by any number other than 1 and themselves. They cannot be divisible by 6.


Is 4059 divisible by eleven?

4059 / 11 = 369 So the answer is yes. Any number is divisible by any other number, it depends on whether the answer is to be in whole numbers without a remainder, or a decimal, etc.


Is 750 divisible by 3?

Yes, by 250. Here's a trick I use to find out whether a number is divisible by 3. If you add up all the digits of the numbers it may equal a multiple of 3, if it does it's divisible by 3. For example. 750: 7+5+0=12, which is divisible by 3.


Is 4783028 a multiple of 2?

Yes. To find out whether or not a number is divisible by 2, look at the last number. If the last number is a 2,4,6,8, or 0, it is divisible by 2 (it's also an even number). If the last number is 1,3,5,7, or 9, it is NOT divisible by to (those are also odd numbers).4783028 is divisible by 2.


How do you determine whether a number is divisible by three?

you add the numbers together and if that is divisible by three then so is that number for example: the number 111, you would do 1+1+1=3 so 111 is dividable by 3; or the number 1,620, 1+6+2+0= 9 (which is divisible by 3) so 1,620 is divisible by 3


Determine whether 2345804 is divisible by 8 or not?

It is not.


Is 5890 divisible by 9?

The trick to determining whether a number is divisible by 9 is to add all the individual numbers of the large number together and see if the result is divisible by 9. Let's add 5 + 8 + 9 + 0 = 22. Since 22 is not neatly divisible by 9, then we know that the larger 5890 is also not divisible by 9. Of course, you can divide it by 9, but there will be something left over.