please help me -

welcome ,please help me I don't understand the question what the homework need

and I don't know how can I solve it .

thank you so much .




Write a program that asks the user to enter two numbers and prints
divisible by 7 numbers between them (i.e. between the entered numbers).

(1) to enter a number, try:

1
2
cin >> number1;
cin >> number2;

refer for example of cin usage to:
http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/

(2) divisible by 7 with no remainder
1
2
3
4
for (int i = number1 + 1; i < number2; ++i) {
  if ((i%7) == 0)
    cout << i << " is divisible by 7" << endl;
}


refer for example of cout usage to:
http://www.cplusplus.com/reference/ostream/ostream/operator%3C%3C/

refer to % operator to:
http://www.cplusplus.com/doc/tutorial/operators/
http://www.cplusplus.com/forum/general/19502/

You'll have to make sure number1 < number2.
Last edited on
Topic archived. No new replies allowed.