fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void print_all_divisible_by_seven(unsigned n)
  5. {
  6. unsigned count = 0;
  7. int number = 1;
  8. while (count < n)
  9. {
  10. if (number % 7 == 0)
  11. {
  12. cout << number << "\n";
  13. ++count;
  14. }
  15. ++number;
  16. }
  17. }
  18.  
  19. int main()
  20. {
  21. print_all_divisible_by_seven(7);
  22. return 0;
  23. }
Success #stdin #stdout 0s 16048KB
stdin
Standard input is empty
stdout
7
14
21
28
35
42
49