Hello, the following may come off as a homework question but in reality I just need some help with loops. I've pretty much finished the entire program, except for the actual calculation part.

"Given a range of values determine how many integers within that range, including the end points, are multiples of a third value entered by the user. The user should be permitted to enter as many of these third values as desired and your output will be the sum of total multiples found."

I've defined functions to take user input for the low range, high range and a do-while loop to take as many third inputs as the user wants (terminated by entering -1, as requested by the question)

To actually calculate if they're divisible, I found out that if A%B = 0, then they are divisible, so I thought I would create a loop where each value in the range between A and B is checked against the third value to see if they output a zero.

What I need to end up with is a program that tells the user how many integers are divisible by the numbers in the range, i.e:

"Enter the low range value: 335

Enter the high range value: 475

Enter a value to check within the range: 17

Enter a value to check within the range: -1

There are 8 total values that are divisible by the numbers in the range."

Going back to my original question, how would I create a loop or something to "check" how many values are equal to zero, and consequently increment a variable for each instance? (This is how I think it should be done)

Really messy code incoming. As you can see towards the end the logic may be going offtrack, signs of my confusion taking place. If someone could at least send me on the right track I would greatly appreciate it.

Code:#include <stdio.h> //GLOBAL DECLARATIONS int getlowR(); int gethighR(int); // int getloopThird(); int checkDivisible(int, int); void printResult( int, int, int); int main(void) { //VARIABLE DECLARATIONS int lowRange = getlowR(); //Low range value, assigned by the function getlowR() int highRange = gethighR(lowRange); //High range values, assigned by the function gethighR() // int thirdInteger = getloopThird(); //Third integer values returned by the function getloopThird() int numberRep = checkDivisible(lowRange, highRange); printResult(lowRange, highRange, numberRep); return(0); } int getlowR() { int lowRange; do { printf("Enter the low range value:"); scanf("%d", &lowRange); if(lowRange < 0) { printf("\nError! Positive integers only!!\n\n"); } }while(lowRange < 0); return(lowRange); } int gethighR(int lowRange) { int highRange; do { printf("Enter the high range value:"); scanf("%d", &highRange); if(highRange < lowRange) { printf("\nError! The high range value must be greater than the low range value!\n\n"); } }while(highRange < lowRange); return(highRange); } /*int getloopThird() { int thirdInteger; do { printf("Enter a value to check within the range:"); scanf("%d", &thirdInteger); } while (thirdInteger != -1); return(thirdInteger); } */ int checkDivisible(int lowrange, int highrange) { int numberRep; int thirdInteger; do { printf("Enter a value to check within the range:"); scanf("%d", &thirdInteger); if (thirdInteger < -1) { printf("\n Error! Third integer cannot be less than -1!!\n\n"); } while (lowrange<highrange) { lowrange++; numberRep = lowrange % thirdInteger; } } while (thirdInteger != -1); return(numberRep); } void printResult(lowRange, highRange, numberRep) { printf("Low range: %d, High range: %d, Third integer: , Reps: %d\n\n", lowRange, highRange, numberRep);