Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int T;
- cin >> T;
- while (T--) {
- int n;
- cin >> n;
- if (n % 7 == 0) {
- cout << n << endl;
- continue;
- }
- int r = n % 7;
- int d = n % 10;
- if (d - r >= 0) {
- cout << n - r << endl;
- } else {
- cout << n + (7 - r) << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement