// product.c // Bob Myers // // A typical kind of for-loop algorithm -- multiplying things #include int main() { int value; long product = 1; // initialize an accumulator variable int i; // loop counter printf("Enter an integer: "); scanf("%d", &value); for (i = 1; i <= value; i++) { if (i % 5 == 0) // if the index is divisible by 5 product = product * i; // multiply it in to the accumulator } printf("In the range 1 through %d,\n", value); printf("\tthe product of the numbers that are divisible by 5 = %d\n", product); return 0; }