printing out non-consecutive numbers

I have the following program that uses the for loop to print out numbers 60 to 1. I, however, need to modify the loop so that it prints out numbers in a way that every succeeding number is 5 less than the preceding one. for instance, i want the output to look like 60...55...50....45 and so on. i have used the cout here for simplification. the actual program is supposed to have the printf in order to output the numbers in a format that would make it look like clock ticking or something.

#include <iostream>
using namespace std;

int main()
{

for (int counter = 60; counter > 0; counter--)
cout << counter << endl;
return 0;
}
Last edited on
""counter5--" can do nothing but give the copiler a undefined variable.
1
2
3
4
5
6
7
8
9
#include <iostream>

int main()
{
  for (int counter = 60; counter > 0; counter -= 5)
    std::cout << counter << ".. " << endl;

  return 0;
}
Topic archived. No new replies allowed.