Which is the best way to find out whether the division of two numbers will return a remainder?
Let us take for example, I have an array with values {3,5,7,8,9,17,19}. Now I need
All the above answers are correct. Just providing with your dataset to find perfect divisor:
#include
int main()
{
int arr[7] = {3,5,7,8,9,17,19};
int j = 51;
int i = 0;
for (i=0 ; i < 7; i++) {
if (j % arr[i] == 0)
printf("%d is the perfect divisor of %d\n", arr[i], j);
}
return 0;
}