Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a, b;
- int sum=0;
- cin >> a >> b;
- for (int i = a; i <= b; ++i) {
- if (i % 7 ==0) {
- i++;
- cout << sum << ' ';
- }
- }
- return 0;
- }
- #include <iostream>
- using namespace std;
- int main() {
- int a, b;
- int number = 0;
- cin >> a >> b;
- for (int i = a; i <= b; i++) {
- if (i % 7 == 0) {
- number++;
- cout << i << ' ';
- }
- }
- cout << "n";
- cout << "number: " << number << "n";
- return 0;
- }
- int deltaA = (a % 7 == 0)? 0 : (7 - (a % 7));
- int count = (b - (b % 7) - (a + deltaA)) / 7 + 1;
- if (count < 0)
- count = 0;
- a = a + 6 / 7 * 7;
- b = b / 7 * 7;
- n = (b - a) / 7 + 1;
Add Comment
Please, Sign In to add comment