// counting.c // Bob Myers // // A commond kind of for-loop algorithm #include int main() { int value; int counter = 0; // initialize a counter variable int i; // loop control variable printf("Enter an integer: "); scanf("%d", &value); for (i = 1; i <= value; i++) { if (i % 5 == 0) // if the index is divisible by 5 counter++; // increment the counter } printf("There are %d numbers divisible by 5 in the range 1 through %d\n", counter, value); return 0; }