I'm trying to write a program that takes numbers from user (a and b) then the program will count up from 1 to x (which is a) and output whether the number in each iteration is divisible by y (which is b) or not.
//while loop deciding if a is divided by b
for (count = 1; count <= a; count++) {
if (a / b == 0) {
printf("%d is divisible by %d\n", a, b);
}
else if (a / b != 0) {
printf("%d is not divisible by %d\n", a, b);
}
}
return 0 ;
}
but when i enter 10 for a and 2 for b the output is
10 is not divisible by 2
ten times
how can i change the code so that each iteration is checked?