fork download
  1. //实验3.4
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a = 0;
  7. for (int b = 1; b <= 599; b++) {
  8. if (b % 3 == 0) {
  9. int c = b;
  10. bool d = false;
  11. while (c > 0) {
  12. if (c % 10 == 5) {
  13. d = true;
  14. break;
  15. }
  16. c /= 10;
  17. }
  18. if (d) {
  19. cout << b << " ";
  20. a++;
  21. }
  22. }
  23. }
  24. cout << endl << "共 " << a << " 个数" << endl;
  25. return 0;
  26. }
  27.  
  28.  
Success #stdin #stdout 0.01s 5292KB
stdin
358
stdout
15 45 51 54 57 75 105 135 150 153 156 159 165 195 225 252 255 258 285 315 345 351 354 357 375 405 435 450 453 456 459 465 495 501 504 507 510 513 516 519 522 525 528 531 534 537 540 543 546 549 552 555 558 561 564 567 570 573 576 579 582 585 588 591 594 597 
共 66 个数