赞
踩
解析:
循环加判断,详见代码:
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, m;
- cin >> n >> m;
- for(int i = 1; i <= n; i++) {
- if (i % m != 0) {
- cout << i << " ";
- }
- }
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。