# divisble?

This is a discussion on divisble? within the C Programming forums, part of the General Programming Boards category; I'm having trouble understanding or determining if a number is divisible by 10. Is 70 divisible by 10? How exactly ...

1. ## divisble?

I'm having trouble understanding or determining if a number is divisible by 10. Is 70 divisible by 10? How exactly is it worked out? I've tried a few divide calculations but it doesn't make sense as to why 10 is divisible.

I'm assuming the following:

70/10 = 7. There is no reminders therefore it's divisible by 10?..

2. The % operator returns zero if the lhs is evenly divisible by the rhs.

Code:
```#include <stdio.h>

int divisible(int x, int y)
{
return x % y == 0;
}

int main()
{
int x = 70, y = 10;
printf("divisible(%d,%d) = %d\n", x, y, divisible(x,y));
x = 42;
printf("divisible(%d,%d) = %d\n", x, y, divisible(x,y));
return 0;
}

/* my output
divisible(70,10) = 1
divisible(42,10) = 0
*/```

3. Basic math.
Code:
```x = 70 / 10;
y = x * 10;

if( y == 70 )
printf( "Yay!" );
else