// counting.cpp // Bob Myers // // A typical kind of for-loop algorithm #include using namespace std; int main() { int value; cout << "Enter an integer: "; cin >> value; int counter = 0; // initialize a counter variable int i; for (i = 1; i <= value; i++) { if (i % 5 == 0) // if the index is divisible by 5 counter++; // increment the counter } cout << "There are " << counter << " numbers divisible by 5 in the range 1 through " << value << '\n'; return 0; }