#include <iostream> using namespace std; int F(int a); int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { if (i % 3 == 0) { int b; b = 0; b=F(i); if (b == 1) { cout << i << endl; } } } } int F(int a) { while(a) { int c; c = a % 10; a = a / 10; if (c == 5) { return 1; } } return 0; }
点赞 评论

相关推荐

牛客网
牛客企业服务